Can you please help me here, why the compiler does not infer the lambda input parameter right?
Example:
void Test(Action<string> n)
{
}
void Test(Action<int,string> n)
{
}
Ok so when doing this:
obj.Test(x=>{}); // compiler doesn't know x is a string
If I do this:
obj.Test((x,y)=>{}); // that works, compiler know x is a int and y is a string
Looks like I will have to specify the input parameter type (?)
obj.Test((string x) => {}) // <-- Prefer not doing this
So any reasons why the compiler can’t get the type right?
Thanks!
Carlos
I just tried to recreate the problem with Visual Studio 2008, and did a screen capture here: http://screencast.com/t/YTAwNmQ4M
I was not able to reproduce the problem. I have seen Visual Studio do things like this in the past, but building always works, and often it is a memory issue. Closing Visual Studio, along with other programs that might be taking a lot of memory, and then starting Visual Studio back up has often helped.
So, basically, my answer is, “did you try turning on off, and then back on again?”