I'm trying to run a function in a task but I'm doing something wrong. Heres an example:
var t = Task<int>.Factory.StartNew(() => GenerateResult(2));
static int GenerateResult(int i)
{
return i;
}
In the end Console.WriteLine(t);
This returns:
System.Threading.Tasks.Task`1[System.Int32]
I want i to be 2. What am I doing wrong here? :/