private async Task<List<T>> Ex_Event(string telNo)
{
SearchConditionData scd = new SearchConditionData { tel=telNo };
List<T> list = await RequestAsync<SearchConditionData, List<T>>(scd, Service.GetIncident);
historyList = ( ... ).Take(30).ToList();
return historyList;
}
I made a method that returns List<>.
But I modified it async, then I can't use List.Count.
Here are some part of my code.
public delegate Task<List<IncidentListData>> HistoryEvent(string telNo);
public event HistoryEvent myHistoryEvent;
Return Type is Task<>. And I want to check the count List in Task.
if (myHistoryEvent(Tel).Count > 0)
But it does not work. And I can't use async, because I called myHistoryEvent() in Interface that public string this[string name]
(IDataErrorInfo)
How Can I check the count of List in Task??
You can check with result of your task.
myHistoryEvent(Tel).Result.Count > 0
Inside result type List Task>.Result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With