See Eric Lippert's response to a similar question. In this specific scenario, they both produce the same compiled code and the same result. The only difference between the two syntaxes is that the second syntax can only be used in variable declaration, which means you can't use it to change the value of an existing variable. For instance:
// Compiles fine
string[] Meats = {"Roast beef", "Salami", "Turkey", "Ham", "Pastrami" };
// Causes compilation error
Meats = {"Roast beef", "Salami", "Turkey", "Ham", "Pastrami" };
// Also causes compilation error
string[] Meats2;
Meats2 = {"Roast beef", "Salami", "Turkey", "Ham", "Pastrami" };
Personally, I would suggest using the second syntax for variable declarations if you're explicitly declaring the type of your variable, as so:
string[] Meats = {"Roast beef", "Salami", "Turkey", "Ham", "Pastrami" };
I would recommend the first syntax if you tend to use the var
keyword, as it makes it clearer what type you're expecting the results to be (readability) and forces the compiler to check for you as well, like so:
var Meats = new string[]{"Roast beef", "Salami", "Turkey", "Ham", "Pastrami" };
In general, it's best to pick one style and be consistent.