- using System.IO;
- using System;
- class arrayOfObjects
- {
- public static void Main(string[] args)
- {
- object[] arrayOfObjects = new object[5];
- arrayOfObjects[0] = 1000;
- arrayOfObjects[1] = 10.00;
- arrayOfObjects[2] = true;
- arrayOfObjects[3] = new DateTime(2013, 12, 12);
- arrayOfObjects[4] = "This is string object";
- foreach(object obj in arrayOfObjects)
- {
- Console.WriteLine("Type: {0}, Value: {1}", obj.GetType(), obj);
- }
- }
- }
Output:
Type: System.String, Value: 1000
Type: System.String, Value: 10.00
Type: System.String, Value: true
Type: System.DateTime, Value: 12/12/2013 00:00:00
Type: System.String, Value: This is string object