手机
当前位置:查字典教程网 >编程开发 >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#中合并DataTable重复行的值

C# Guid.NewGuid获得随机数

c#剪切板操作的简单实例

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

C#字符串常见操作总结详解

C# 获取系统进程的用户名

二叉树的遍历算法(详细示例分析)

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

c# list部分操作实现代码

c# 二分查找算法

精品推荐
分类导航