c#異步task示例分享(異步操作)
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();
}
}
}
相關(guān)文章
C#實(shí)現(xiàn)從windows剪貼板獲取內(nèi)容的方法
這篇文章主要介紹了C#實(shí)現(xiàn)從windows剪貼板獲取內(nèi)容的方法,涉及C#操作剪貼板的相關(guān)技巧,非常簡(jiǎn)單實(shí)用,需要的朋友可以參考下2015-05-05C#實(shí)現(xiàn)托盤程序并禁止多個(gè)應(yīng)用實(shí)例運(yùn)行的方法
這篇文章主要介紹了C#實(shí)現(xiàn)托盤程序并禁止多個(gè)應(yīng)用實(shí)例運(yùn)行的方法,涉及C#中NotifyIcon控件的使用及設(shè)置標(biāo)志位控制程序只運(yùn)行一個(gè)的實(shí)現(xiàn)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-11-11