2017-04-06 4 views
1
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; 
} 

List <>을 반환하는 메소드를 만들었습니다.작업 목록에서 어떻게 계산합니까?

그러나 비동기로 수정 한 다음 List.Count를 사용할 수 없습니다.

내 코드의 일부입니다.

public delegate Task<List<IncidentListData>> HistoryEvent(string telNo); 
public event HistoryEvent myHistoryEvent; 

반환 유형> 작업 <입니다. 그리고 Task in count 목록을 확인하고 싶습니다.

if (myHistoryEvent(Tel).Count > 0) 

그러나 작동하지 않습니다. 인터페이스에서 myHistoryEvent()를 호출 했으므로 비동기를 사용할 수 없습니다. public string this[string name] (IDataErrorInfo)

어떻게 작업의 목록 수를 확인할 수 있습니까 ??

+2

많은 튜토리얼이 있지만 기본 사항을 먼저 이해해야합니다. – Robert

답변

0

작업 결과로 확인할 수 있습니다.

myHistoryEvent(Tel).Result.Count > 0 

내부 결과 유형 목록 작업>. 결과.

+0

와우 정말 간단 !! 감사 :) – parfum

관련 문제