Return int from function : Method Return : Class C# Examples


C# Examples » Class » Method Return »

 

Return int from function





Methods return a value to the calling routine using this form of return:




    
return  value;
    
   
  
   

value is the value returned.




    
using  System;

class  MainClass
{
      public  static  int  GetHour()
      {
            return  123;                                      
      }

      static  void  Main()
      {
            Console.WriteLine("Hour:  {0}",  GetHour());
      }
}
    
   
  
   



Output

Hour: 123


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Method Return