Mega Code Archive

 
Categories / C# / Collections Data Structure
 

Use the Length array property

// Use the Length array property.     using System;    public class LengthDemo {     public static void Main() {       int[] nums = new int[10];         Console.WriteLine("Length of nums is " + nums.Length);          for(int i=0; i < nums.Length; i++)         nums[i] = i * i;          Console.Write("Here is nums: ");      for(int i=0; i < nums.Length; i++)         Console.Write(nums[i] + " ");         Console.WriteLine();    }   }