Check OverflowException for long : Predefined Exception : Language Basics C# Examples


C# Examples » Language Basics » Predefined Exception »

 

Check OverflowException for long









    
using  System;

class  MainClass
{
    static  void  Main(string[]  args)
    {
        int  MyInt  =  12345000;
        long  MyLong  =  MyInt;
        
        try
        {
            long  c  =  checked(MyLong  *  5000000);
        }
        catch  (OverflowException  e)
        {
            Console.WriteLine(e);
        }

    }

}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Language Basics
» Predefined Exception