ceci
ceci

Reputation: 429

C# declaring an array

Can anyone explain to me the difference between the two arrays?

string[] adminUsers = { "user1", "user2","user3" };
                    VS
var adminUsers = new string[] { "user1", "user2","user3" };

Which is the better way to declare an array?

Upvotes: 0

Views: 66

Answers (1)

MikeB
MikeB

Reputation: 2452

They are the same. MSDN states "You can also omit the new operator"

Upvotes: 2

Related Questions