标签:class blog com get string for
class Program { static void Main(string[] args) { Func<int> func = new Func<int>(GetInt); var iar = func.BeginInvoke(new AsyncCallback(Show), null); while (!iar.IsCompleted) { Thread.Sleep(1000); Console.WriteLine("收到了您的提示!"); } Console.WriteLine("处理结果为{0}!",func.EndInvoke(iar)); Console.ReadKey(); } private static void Show(IAsyncResult iar) { while (iar.IsCompleted) { Console.WriteLine("执行完毕!"); break; } } private static int GetInt() { for (var i = 0; i < 10; i++) { Console.WriteLine("请稍等,我正在执行,需要点时间"); Thread.Sleep(1000); } return 1; } }
标签:class blog com get string for
原文地址:http://www.cnblogs.com/bygrace/p/3808095.html