Declaring


There are a number of ways you can declare a dynamic array.
In C# the square brackets must come after the type.

long[] myArray = new long[]; 

In C# it is good practice to include "new" when declaring and initialising an array on one line although you don't have to.

string[] myArray = new string[] {"one","two","three"} 
string[] myArray = string[] {"one","two","three"}
string[3] myArray = string[] {"one","two","three"}



© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext