Using string array in C#

To create a stirng array we can define array of string type and length of array.

string[]arr = new string[5];

We can assign value to array by using index of array. Similarly we can get value by using index of array.

Assigning value to array

arr[0] = "One";
arr[1] = "Two";
arr[2] = "Three";
arr[3] = "Four";
arr[4] = "Five";

Getting value from array


string val = arr[2];

Comments

Popular posts from this blog

Check if ViewBag is null or doesn't exist

Using Progress Bar In C#

Jquery serer side datatables in asp.net