简体   繁体   中英

web api asynchronous method from .net application

I have a web api 2 application and a wpf client. my question is that LINQ to Entities support multiple asynchronous method, like ToListAsync, ToArrayAsync and so on.

But in my wpf client application, there are no such things.

Can anyone give me some examples for asynchronous method in client application?

Web API calls are just straight HTTP calls. Just use the HttpClient class.

Asynchronous coding reference

Task<string> getStringTask = client.GetStringAsync("http://msdn.microsoft.com");

// You can do work here that doesn't rely on the string from GetStringAsync.
DoIndependentWork();

string urlContents = await getStringTask;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM