Getting and setting array values C# with Example



Getting and setting array values C# with Example

int[] arr = new int[] { 0, 10, 20, 30}; 
// Get 
Console.WriteLine(arr[2]); // 20 
// Set 
arr[2] = 100; 
//  Get  the  updated  value 
Console.WriteLine(arr[2]); // 100 

0 Comment's

Comment Form