http://www.cnblogs.com/leslies2/archive/2012/02/08/2320914.html

AsParallel

通常想要实现并行查询,只需向数据源添加 AsParallel 查询操作即可。

     class Program
{
static void Main(string[] args)
{
var personList=GetPersonList().AsParallel()
.Where(x=>x.Age>);
Console.ReadKey();
} //模拟源数据
static IList<Person> GetPersonList()
{
var personList = new List<Person>(); var person1 = new Person();
person1.ID = ;
person1.Name = "Leslie";
person1.Age = ;
personList.Add(person1);
...........
return personList;
}
}

阿华说List会有问题  建议用

ConcurrentBag<object> 要用这个集合来接收并发数据 AsParallel().ForEach(o=>bag.add(o))
感谢阿华孜孜不倦的回答我的每个问题

AsParallel 用法的更多相关文章

  1. 【Win 10 应用开发】Sqlite 数据库的简单用法

    如果老周没记错的话,园子里曾经有朋友写过如何在 UWP 项目中使用 Sqlite数据库的文章.目前我们都是使用第三方封装的库,将来,SDK会加入对 Sqlite 的支持. 尽管目前 UWP-RT 库中 ...

  2. C# LINQ查询表达式用法对应Lambda表达式

    C#编程语言非常优美,我个人还是非常赞同的.特别是在学习一段时间C#后发现确实在它的语法和美观度来说确实要比其它编程语言强一些(也可能是由于VS编译器的加持)用起来非常舒服,而且对于C#我觉得他最优美 ...

  3. EditText 基本用法

    title: EditText 基本用法 tags: EditText,编辑框,输入框 --- EditText介绍: EditText 在开发中也是经常用到的控件,也是一个比较必要的组件,可以说它是 ...

  4. jquery插件的用法之cookie 插件

    一.使用cookie 插件 插件官方网站下载地址:http://plugins.jquery.com/cookie/ cookie 插件的用法比较简单,直接粘贴下面代码示例: //生成一个cookie ...

  5. Java中的Socket的用法

                                   Java中的Socket的用法 Java中的Socket分为普通的Socket和NioSocket. 普通Socket的用法 Java中的 ...

  6. [转载]C#中MessageBox.Show用法以及VB.NET中MsgBox用法

    一.C#中MessageBox.Show用法 MessageBox.Show (String) 显示具有指定文本的消息框. 由 .NET Compact Framework 支持. MessageBo ...

  7. python enumerate 用法

    A new built-in function, enumerate() , will make certain loops a bit clearer. enumerate(thing) , whe ...

  8. [转载]Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法总结

    本文对Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法进行了详细的总结,需要的朋友可以参考下,希望对大家有所帮助. 详细解读Jquery各Ajax函数: ...

  9. 【JavaScript】innerHTML、innerText和outerHTML的用法区别

    用法: <div id="test">   <span style="color:red">test1</span> tes ...

随机推荐

  1. perl-cgi命令行调试

    来源: http://www.cnblogs.com/itech/archive/2012/09/23/2698838.html 参考: http://docstore.mik.ua/orelly/l ...

  2. spice-vdagent

    The spice-vdagent should be running in the guest. Have you installed the spice guest tools in your w ...

  3. 安装sysbench遇到找不到库文件的问题

    export LD_LIBRARY_PATH=/usr/mysql/lib./configure --prefix=/usr/local/sysbench --with-mysql-includes= ...

  4. TabControl选项卡

    <Grid> <TabControl Name="tabControl1"> <TabItem Name="tabItem1"&g ...

  5. UVA - 10635 最长公共子序列

    input n,p,q 2<=n<=250 1<=p,q<=n*n 1 a1 a2 a3 ... ap 1<ai<n*n,ai!=aj 1 b1 b2 b3 ... ...

  6. iOS NSMutableArray添加NSInteger元素

    NSMutableArray *array = [[NSMutableArray alloc] init]; NSInteger num = 7; NSNumber *number = [NSNumb ...

  7. sql 语句操作

    插入:insert into table1(field1,field2) values(value1,value2) db.execSQL(sql) db.execSQL(sql, bindArgs) ...

  8. Python里如何实现C中switch...case的功能

    python没有switch case 不过可以通过建立字典实现类似的功能 例子:根据输入的年月日,判断是该年中的第几天 y = int(input('请输入年:')) m = int(input(' ...

  9. JVM CPU打满问题定位

    1.线程不释放,导致Old区占满,系统不停的FullGC 发现应用并没有在进行FGC,而是进行频繁的YGC. YGC也存在异常,S1和S0区域都是从0直接跳到99% 观察堆大小装太发现Young区内存 ...

  10. loadrunner常用计数器分析

    内存是第一个监视对象,确定系统瓶颈的第一个步骤就是排除内存问题.内存短缺的问题可能会引起各种各样的问题. Object(对象) Counters Description(描述) 参考值 Memory ...