Passing a Func<int, int> to Task.Run() in C# without using lambda expressions
问题 I try to get my head around the Task/Func/Action/await functionality of C# but still need your help: I have a button click event handler in my gui thread that, when called, does the following: Func<int> t = new Func<int>(CountToBillion); int result = await Task.Run(t); //do something with result value... The method itself is declared as: private int CountToBillion() { //count to 1 billion and return 0 } So far, this runs without error. But if I want to pass a parameter to CountToBillion()