Does anyone know the full list of C# compiler number literal modifiers?
By default declaring \'0\' makes it an Int32 and \'0.0\' makes it a \'Double\'. I can use the
If you don't want to have to remember them, then the compiler also accepts a cast for the same purpose (you can check the IL that the effect is the same - i.e. the compiler, not the runtime, does the cast). To borrow the earlier example:
var y = (float)0; // y is single
var z = (double)0; // z is double
var r = (decimal)0; // r is decimal
var i = (uint)0; // i is unsigned int
var j = (long)0; // j is long
var k = (ulong)0; // k is unsigned long
And for the record, I agree that "var" is a bad choice here; I'll happily use var for a SortedDictionary