Syntax of Simple Array Declaration in C#
This topic contains and tries to cover following subjects:
- Syntax of simple fixed size array declaration
- Detailed C# Array example has been provided in C# Language section.
Articles provides answer to following questions and issues:
- How to declare a simple fixed size Array in C#?
Syntax of Simple Array Declaration in C#
Arrays in C# are declared and initialized as follows:
-Type- [] -variableName- = new -Type- [size];
Example of Simple Array Declaration in C#
Following example shows simple array declaration and initialization in C#. It creates 3 item sized fixed sized array: further indicates how to fill the array items with values.
string [] v_arr_places = new string [2];
v_arr_places[0] = "Nebraska";
v_arr_places[1] = "Nevada";
v_arr_places[2] = "Brooklyn";