You need to use t.Result .
for instance
Console.WriteLine(ttResult);
Your code looks something like this:
Task<int> t = Task<int>.Factory.StartNew(() => GenerateResult(2));
And when you write Console.WriteLine(t); , you are actually just typing Task , not integer . To access the result, you need to add .Result .
source share