在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using System.Threading; using System.Threading.Tasks; namespace TestApp { class Program { static void Main(string[] args) { Task<string> task = Call(); Console.WriteLine("测试"); Console.WriteLine(task.Result); } static string Greeting(string name) { Thread.Sleep(3000); return string.Format("Hello, {0}", name); } static Task<string> GreetingAsync(string name) { return Task.Run<string>(() => { return Greeting(name); }); } private async static Task<string> Call() { string result = await GreetingAsync("world"); return result; } } }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论