Array in C#
Before making an array example in C# language, you need to install Visual Studio 2022 or Visual Studio Code.
IDE download link: Visual Studio 2022 Community
For VS2022 when creating a new project, select Console App (.NET Framework).
Console App (.NET Framework) everything will integrate in VS2022 IDE.
With Console App you need to install .NET for your operating system: Windows, Linux, MacOS.
Example program using arrays in C#
Declare an array with elements of data type string
string[] cat;
Initialize an array of data type string with 5 elements
cat = new string[5];
Shortened form for both initialization and declaration
string[] cat = new string[5];
Assign string to array element
cat[0] = "cat 1";
1st array element: cat[0] -> 5th array element: cat[4]
Accessing each array element prints the values in the array