Can you store different types in an array in CSharp

Yes,

class Program
    {
        static void Main(string[] args)
        {
            object[] objectArray = new object[3];
            objectArray[0] = 101;
            objectArray[1] = "C#";
            Customer c = new Customer();
            c.ID = 99;
            c.Name = "Nisaar";
            objectArray[2] = c;

            foreach (object obj in objectArray) { Console.WriteLine(obj); }
            Console.Read();
        }
    }
    class Customer
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public override string ToString() { return this.Name; }
    }

results matching ""

    No results matching ""