Invoke a method in a class : Class Instance : Class C# Examples


C# Examples » Class » Class Instance »

 

Invoke a method in a class









    
using  System;


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

      static  void  Main()
      {
            MyClass  mc  =  new  MyClass();
            mc.PrintDateAndTime();                          
      }
}
    
   
  
   



Output

25/03/2007 2:14:04 PM


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Class Instance