I have the WCF service which return the collection of objects.
He is working code I started with (I'm not sure it is correct):
List<AxaptaServiceReference.Inspection> remoteInspections = (await proxy.GetInspectionsByInspectorAsync(App._winlogin)).ToList<AxaptaServiceReference.Inspection>();
I need to move this call to separate class:
public class AxGateWay
{
public async List<AxaptaServiceReference.Inspection> GetInspections(string _inspector)
{
AxaptaServiceReference.AxaptaWebServiceClient proxy = new AxaptaServiceReference.AxaptaWebServiceClient();
List<AxaptaServiceReference.Inspection> remoteInspections = (await task).ToList<AxaptaServiceReference.Inspection>();
return remoteInspections;
}
}
Compiler say me that async method must return Task (or Task<>).
How do I need to rewrite my method and how this method call must be if I want to be sure that my code will wait when the Web Service returns the data.