0

Does an array in C# can elements more than a single data type, simultaneously?

Like: An array : {23, "Rohan" , 23.232 , 2.2}

3rd Oct 2020, 10:38 AM
Rohan Agarwal
Rohan Agarwal - avatar
1 Réponse
+ 4
You can do that by creating an array of object type. object[] arr = {1,"string",2.2,true}; foreach(object x in arr) Console.WriteLine(x);
3rd Oct 2020, 11:08 AM
Avinesh
Avinesh - avatar