摘要: 1. Task task = new Task(() => { MultiplyMethod(a, b); }); task.Start(); 2. Task task = Task.Run(() => { MultiplyMethod(a, b); }); 3. Task task = Task. 阅读全文
posted @ 2016-08-17 22:54 FredGrit 阅读(2922) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(127) 评论(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 阅读(534) 评论(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 阅读(185) 评论(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 阅读(709) 评论(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 阅读(179) 评论(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 阅读(337) 评论(0) 推荐(0) 编辑
摘要: Enum.GetUnderlyingType(obj.GetType())获取保存枚举值的数据类型; 阅读全文
posted @ 2016-06-06 23:11 FredGrit 阅读(669) 评论(0) 推荐(0) 编辑
摘要: out输出,在调用函数中声明,在被调用函数中赋值; ref在调用函数中赋值,后调用; params修饰符,static double CalculateAverage(params[] values)可以带数组作为参数; 可选参数,调用者不必指定不必要的参数,而要使用这些参数的默认值,可选参数必须编 阅读全文
posted @ 2016-06-06 21:58 FredGrit 阅读(170) 评论(0) 推荐(0) 编辑
摘要: Console.WriteLine(linq.GetType().Name); WhereArrayIterator`1 Console.WriteLine(linq.GetType().NameSpace); System.Linq 阅读全文
posted @ 2016-06-03 23:25 FredGrit 阅读(186) 评论(0) 推荐(0) 编辑