I've got really simple code:
static void Main(string[] args)
{
var task = Task.Factory.StartNew(GetInt);
var task2 = Task.Factory.StartNew(
() =>
{
return GetInt();
});
}
static int GetInt()
{
return 64;
}
Why do I get a compiler error for the first task?
The method signatures (no params, return type is int
) are equal, aren't they?
I know a solution(which is quite simple: var task = Task.Factory.StartNew<int>(GetInt);
) but I'd like to know whats the problem with the code above.