Wednesday, May 12, 2004

Boxing and ? : - Eric Gunnerson responds...

I wasn't content in just posting my annoyance - so I forwarded it to Eric Gunnerson, who actually replied (I don't know how he has the time - I hereby apologize to everyone for wasting his time and thereby contributing to .NET 2.0 being delayed):
"Oskar, "The compiler behavior is correct, though perhaps a bit surprising. "When the compiler is evaluting such an expression, it needs to determine the type of the expression. If the types are different, it does this by trying to convert between them, and if A can be converted to B, it chooses B as the type of the expression. "In your example, there is no such conversion, so you get the error message. "This is covered in section 7.12 of the language spec."
...and also in Section 14.12 of the ECMA C# Language Specification I promise I'll RTFM before wasting Eric's time next time I have a question...


Post a Comment

<< Home