Generally an array cannot store data from different types like int and string as in contrast to lists.

Therefore in most cases you should prefer to use a generic List<T> described in my following post

In case you want to use an array to store data from different types, you first need to create a class and define the different types inside this new class, after that you can create an array with the type from this class.

The following example has a custom class CountryPopulation with two properties Country and Population from different data types string and int.

In the Main method we create an array countries which is referenced a new instance of our class CountryPopulation as array.

So countries is an array of the CountryPopulation class as predifined arrays like string are arrays of the string class.

The countries array get the size 4 and therefore will store 4 reference types to our class.

class Program
        static void Main(string[] args)
            CountryPopulation[] countries = new CountryPopulation[4];

            countries[0] = new CountryPopulation { Country = "Germany", Population = 83 };
            countries[1] = new CountryPopulation { Country = "USA    ", Population = 328 };
            countries[2] = new CountryPopulation { Country = "France ", Population = 66 };
            countries[3] = new CountryPopulation { Country = "Spain  ", Population = 46 };

            foreach (var c in countries)
                Console.WriteLine(c.Country + "    " + "Population in m: " + c.Population);




    class CountryPopulation
        public string Country { get; set; }
        public int Population { get; set; }