如何写async linq [英] How to write async linq
本文介绍了如何写async linq的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个查询:
public static class myClass
{
list<something> myList = new list<something>();
public void PopulateList()
{
var myQuery = from a in db.something
where a.someproperty == somevar
select a;
myList = myQuery.Tolist();
}
}
我如何做这个查询异步? / p>
How can i do to make this query async?
推荐答案
可怜的人的异步/等待
await Task.Factory.StartNew(() => PopulateList());
编辑
对于那些想要看到它的用法的人
For those who want to see the usage of it
我如何连续发送邮件?及其后续问题
这篇关于如何写async linq的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文