12 2015 档案
摘要:在线程里再创建一个线程,这就是父子线程父线程的结束并不影响子线程因为在进程层面里,大家都是平级的 static void Method2() { System.Threading.Thread.Sleep(5000); Console.Wri...
阅读全文
摘要:在一个给定的Assembly中, 如果两个匿名类型拥有同样数量的属性, 并且他们有相同的名字和类型, 以及相同的出现顺序, 那么编译器将会把他们当成同一个类型.var arr=new []{new {Name="zahng",Age=134},new {Name="zhhh",Age=111}}编译...
阅读全文
摘要:数组合并了相同类型的对象,而元组合并了不同类型的对象。Tuple err_1=Tuple.Create(1,"没有登陆");调用err_1.Item1err_1.Item2
阅读全文
摘要:原文链接http://www.cnblogs.com/A_ming/archive/2013/05/24/3097062.html public static class LinqEx { public static IEnumerable DistinctBy(this IEn...
阅读全文
摘要:测试了100次,.net 4.0,每次循环赋值 100*10000次直接访问5ms纯反射平均时间 260msEmit注入IL代码 60ms泛型委托 40ms表达式树 65ms泛型委托最快,相应于直接访问的8倍委托之所以快,我觉得跟 委托相当于函数指针有关(可能委托与指针的转换就是消耗本身吧),C函数...
阅读全文
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Reflection;using System.Reflection.Emit;namespace SaftS...
阅读全文
摘要:1.第一个模板 判断字段是否为空 类IsNullableType.cmtstatic public partial class CommonType { public static bool IsNullableType(Type theType) { ...
阅读全文
摘要:enum Days { Nothing=0, Mon=1, Stu=2 }static void Main(string[] args) { foreach (int item in Enum.Get...
阅读全文