Compiler Tricks - Inferred Types
The .NET compiler is a terrific thing… After all, it turns your C# into an executable program!
One nice feature of the .NET compiler, which is becoming better each release, is inferred typing. I’d like to lay out a few short examples that might help you develop your programming standards and practices.
Inferring a type when creating an array.
// Create and initialize an array
var myArray = new int[] { 1, 2, 3 };
Becomes: