Cem Kaya
2
Q:

c# inline array initialization

//you can apply arrays to any variable

//string array
string[] names = {"Guy", "Ryan", "Jim"};

//int array
int[] ages = {14, 16, 17, 19};

//bool array
bool[] timeRecord = {2.3, 5.6, 3.3};
1
var array = new string[2]; // creates array of length 2, default values
var array = new string[] { "A", "B" }; // creates populated array of length 2
string[] array = { "A" , "B" }; // creates populated array of length 2
var array = new[] { "A", "B" }; // created populated array of length 2 
0

New to Communities?

Join the community