Siva s
20
Q:

make new array in c#

// Define and Initialize
int[] arr = {1, 2, 3};

// Buuuut:
// Initial defining
int[] arr;

// This works
arr = new int[] {1, 2, 3};   

// This will cause an error
// arr = {1, 2, 3}; 
12
string[] stringArray = new string[6];
4
string[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
3
float[] array = new float[] { 1f, 5f, 4f, 3f };
5

New to Communities?

Join the community