源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

c#异步task示例分享(异步操作)

  • 时间:2021-09-10 21:56 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:c#异步task示例分享(异步操作)
c# Task异步操作
[u]复制代码[/u] 代码如下:
using System; using System.Threading; using System.Threading.Tasks; namespace ConsoleApplication18 {     class Program     {         static void Main(string[] args)         {             Func<string, string> _processTimeFunc = new Func<string, string>((string arg) =>            {                return string.Format("{0} {1}", arg, DateTime.Now);            });             Task.Factory.FromAsync<string, string>(_processTimeFunc.BeginInvoke, _processTimeFunc.EndInvoke, "Zhuzhou", null)                 .ContinueWith((result) =>                 {                     Console.WriteLine(result.Result);                 });             Console.ReadLine();         }     } }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部