Invoke a method in a class : Class Instance « Class « C# / CSharp Tutorial






using System;


class MyClass
{
   void PrintDateAndTime()               
   {
      DateTime dt = DateTime.Now;        
      Console.WriteLine("{0}", dt);      
   }

   static void Main()
   {
      MyClass mc = new MyClass();
      mc.PrintDateAndTime();             
   }
}
25/03/2007 2:14:04 PM








7.2.Class Instance
7.2.1.Invoke a method in a class
7.2.2.Instance Class Members
7.2.3.Try to change static value in different instance
7.2.4.public member method
7.2.5.Creating an array of objects.
7.2.6.Call GetType and ToString on object instance