摘要: class Program { static void Main(string[] args) { (new Program()).MyMethodAsync(); Console.ReadLine(); } public async Task MyMethodAsync() { Task<int> 阅读全文
posted @ 2016-08-17 22:31 FredGrit 阅读(126) 评论(0) 推荐(0) 编辑
摘要: static int BinarySearch(int[] arr,int key,int low,int high) { low = 0;high = arr.Length - 1; while(low<=high) { int mid = (low + high) / 2; if (arr[mi 阅读全文
posted @ 2016-08-16 21:13 FredGrit 阅读(533) 评论(0) 推荐(0) 编辑
摘要: 1.Task.Run(); static void Main(string[] args) { long a = 9876545678, b = 987654567892; Task task = Task.Run(() => { Add(a, b); }); Console.ReadLine(); 阅读全文
posted @ 2016-08-15 22:43 FredGrit 阅读(183) 评论(0) 推荐(0) 编辑
摘要: private void btnExport_Click(object sender, RoutedEventArgs e) { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); dg. 阅读全文
posted @ 2016-08-15 22:22 FredGrit 阅读(704) 评论(0) 推荐(0) 编辑
摘要: Console.WriteLine("Name:{0},Value:{0:D}", enumData.GetValue(i)); Name:Black,Value:0Name:DarkBlue,Value:1Name:DarkGreen,Value:2Name:DarkCyan,Value:3Nam 阅读全文
posted @ 2016-06-13 23:18 FredGrit 阅读(176) 评论(0) 推荐(0) 编辑
摘要: Array enumData = Enum.GetValues(e.GetType()); Console.WriteLine("This enum has {0} members.", enumData.Length); for (int i = 0; i < enumData.Length; i 阅读全文
posted @ 2016-06-13 23:05 FredGrit 阅读(336) 评论(0) 推荐(0) 编辑
摘要: Enum.GetUnderlyingType(obj.GetType())获取保存枚举值的数据类型; 阅读全文
posted @ 2016-06-06 23:11 FredGrit 阅读(666) 评论(0) 推荐(0) 编辑
摘要: out输出,在调用函数中声明,在被调用函数中赋值; ref在调用函数中赋值,后调用; params修饰符,static double CalculateAverage(params[] values)可以带数组作为参数; 可选参数,调用者不必指定不必要的参数,而要使用这些参数的默认值,可选参数必须编 阅读全文
posted @ 2016-06-06 21:58 FredGrit 阅读(169) 评论(0) 推荐(0) 编辑
摘要: Console.WriteLine(linq.GetType().Name); WhereArrayIterator`1 Console.WriteLine(linq.GetType().NameSpace); System.Linq 阅读全文
posted @ 2016-06-03 23:25 FredGrit 阅读(185) 评论(0) 推荐(0) 编辑
摘要: private var a = 10; var 不能用于字段数据; var int; int =10; var 不能先声明后赋值; 阅读全文
posted @ 2016-06-03 23:14 FredGrit 阅读(96) 评论(0) 推荐(0) 编辑