 int a, b; // Declaring multiple variables of the same type

int a = 2, b = 3; // Declaring and initializing multiple variables of the same type


C# 3.0 introduced type inference, allowing the type specifier of a variable declaration to be replaced by the keyword , if its actual type can be statically determined from the initializer.This reduces repetition, especially for types with multiple generic type-parameters, and adheres more closely to the DRY principle.var myChars = new char[] {'A', 'Ö'}; // or char[] myChars = new char[] {'A', 'Ö'};

var myNums = new List(); // or List myNums = new List();


See also

Constants are immutable values.