27.7 并行语言集成查询(PLinq)
2024-08-31 00:55:50
static void Main()
{
ObsoleteMethods(Assembly.Load("mscorlib.dll"));
Console.ReadKey();
}
private static void ObsoleteMethods(Assembly assembly)
{
var query = from type in assembly.GetExportedTypes().AsParallel()
from method in type.GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Static)
let obsoleteAttrType = typeof(ObsoleteAttribute)
where Attribute.IsDefined(method, obsoleteAttrType)
orderby type.FullName
let obsoleteAttrObj = (ObsoleteAttribute)Attribute.GetCustomAttribute(method, obsoleteAttrType)
select string.Format("Type={0} \n Mehthod={1} \n Message={2} \n ", type.FullName, method, obsoleteAttrObj.Message);
foreach (var item in query)
Console.WriteLine(item);
//query.ForAll(a => Console.WriteLine(a)); //让多个线程同时调用Console反而损害性能,因为Console在内部进行线程同步
//query.Distinct().AsOrdered();
//query.OrderBy(a => a.Length).AsUnordered();
//query.WithExecutionMode(ParallelExecutionMode.ForceParallelism);
//query.WithMergeOptions(ParallelMergeOptions.AutoBuffered);
}
最新文章
- File类使用小结
- 求数组的长度 C
- 20.(转)Android的样式(Style)和主题(Theme)
- 配置mybatis流程
- java dos下中文乱码
- [Android]The connection to adb is down, and a severe error has occured.
- objective-c 关键字和概念
- 介绍一个python的新的web framework——karloop框架
- liunx tomcat多站点配置
- 飞天熊猫游戏源代码android文本
- wpf阻止键盘快捷键alt+space,alt+F4
- 众说纷纭的ul、ol、li
- 阿里云ECS服务器部署Node.js项目全过程详解
- wsgi 协议
- java类文件
- PHP常见错误级别及错误码
- Etcd源码解析(转)
- 移动端调试利器之vconsole
- Spring Boot 概述
- SDN前瞻 传统网络的缺陷
热门文章
- linux设备驱动程序_hello word 模块编译各种问题集锦
- The Breakpoint will not currently be hit. No executable code associated with this line
- springmvc20170322
- 技术的止境(客户价值第一,快速实现第二,边做边学,迅速成为牛人。紧贴客户的需求去做技术,立于不败之地。追求的目标:把一项产品去做好,用产品去养活自己和家人)good
- WebSocket握手总结
- IDEA Spark Streaming 操作(套接字流)-----make socket数据源
- 8.4 IP地址的划分及子网划分
- jQuery Validate插件实现表单强大的验证功能
- Mac 终端执行JavaScript
- [Swift通天遁地]二、表格表单-(9)快速创建一个美观强大的表单