Array means collection of similar Data Types or Store Collection of similar Data Types Value in Array.
Ex:
- int[] no = new int[2];
- int[] no = new int[2];
- no[0] = 9080;
- no[1] = 8090;

But we can store different data type value in array as;
- namespace Array
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool b = true;
- object[] obj = new object[3];
- obj[0] = 1;
- obj[1] = "Vishu";
- obj[2] = b;
- Console.WriteLine("value of Array 0 as" + " " + obj[0] + " ");
- Console.WriteLine();
- Console.WriteLine("and value of array 1 as" + " " + obj[1] + "");
- Console.WriteLine();
- Console.WriteLine("and value of array 2 as" + " " + obj[2] + "");
- Console.ReadLine();
- }
- }
- }
Object is Reference Type , you can assign any value type and reference type variable to object data type.
Output


Join the conversation! Your thoughts help the community grow.