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

内容摘要
c# Task异步操作
复制代码 代码如下:using System;using System.Threading;using System.Threading.Tasks;
namespace ConsoleApplication18{ class Program {
文章正文

c# Task异步操作

复制代码 代码如下:

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();
        }

    }
}


代码注释

作者:喵哥笔记

IDC笔记

学的不仅是技术,更是梦想!