C# Task总结(Action,Func,委托)
Task的参数有两种,一种是Action,一种是Func。
使用Action
public static void FFF(object a) { Console.WriteLine(a); } var s = Task<int>.Factory.StartNew(new Action<object>(FFF), 10);
使用Func
public static int FFF(object a) { Console.WriteLine(a); return 0; } var s = Task<int>.Factory.StartNew(new Func<object, int>(FFF), 10); Console.WriteLine(s.Result);