What are mixed arrays in C#?

CsharpProgrammingServer Side Programming

Mixed arrays are a combination of multi-dimension arrays and jagged arrays.

Note − The mixed arrays type is obsolete now since .NET 4.0 update removed it.

Let us see how you can declare a mixed array −

var x = new object[] {89,45,"jacob",9.8}

We can also set them as −

var x = new object[] {87, 33,"tim",6.7, new List<string>() {"football","tennis","squash",“cricket”} }

Since, mixed arrays are obslete now. For the same work, use the List collection. Here, we have set int and string in the list −

Tuple<int, string> tuple = new Tuple<int, string>(60, "John");

The same example is displayed below:

using System;
using System.Collections.Generic;

class Program {
   static void Main() {
      // Initializing collections
      Tuple tuple = new Tuple(99, "Jack");
      if (t.Item1 == 99) {
Published on 10-Aug-2018 16:29:07