In C#, the following type-inference works:
var s = \"abcd\";
But why can\'t the type be inferred when the variable is a constant?
T
Interesting. I don't know if it is just a limitation of the C# compiler or if it a fundemental limitaion of the language itself.
To explain what I mean, consider VB.
In VB 9 you also couldn't infer constants, but this was just a limitation of the compiler. In VB 10 they were able to add constant type inference without making any significant changes the to language.