Array Of Objects C# with Example



Array Of Objects C# with Example

 	using System;

	namespace CSharpFundamentals
	{
		class ArrayOfObjects
		{
			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);
				}
			}
		}
	}
 

0 Comment's

Comment Form

Submit Comment