I have a very 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 am I getting a compiler error for the first task? Method signatures (no parameters, int return type) are equal, right?
I know the solution (which is pretty simple: var task = Task.Factory.StartNew<int>(GetInt); ), but I would like to know what the problem is with the above code.
c # compiler-errors task
GameScripting
source share