手机
当前位置:查字典教程网 >编程开发 >C#教程 >c#异步task示例分享(异步操作)
c#异步task示例分享(异步操作)
摘要:c#Task异步操作复制代码代码如下:usingSystem;usingSystem.Threading;usingSystem.Threa...

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

}

}

}

【c#异步task示例分享(异步操作)】相关文章:

c#对字符串操作的技巧小结

C#枚举数值与名称的转换实例分享

c#(Socket)同步套接字代码示例

c#中合并DataTable重复行的值

C#中一些字符串操作的常用用法

C#数据结构与算法揭秘一

c# 对cookies(增、删、改、查)的操作方法

c#简单读取文本的实例方法

C# WinForm捕获全局变量异常 SamWang解决方法

c# 关闭窗体时提示的小例子

精品推荐
分类导航