Using asynchronous tasks to call synchronous WCF service
问题 I have a WCF service, called by a service client. I'd like to use the async / await constructs to wrap the call to this; however, the service and service client are .NET3.5. My solution to this is as follows: private async Task<ObservableCollection<MyEntity>> LoadData(ParamData param) { ServiceClient svc = new ServiceClient(); int results = 0; // Set-up parameters myParams = BuildParams(param); // Call a count function to see how much data we're talking about // This call should be relatively