Exception Handling Fundamentals : Try Catch : Language Basics C# Examples


C# Examples » Language Basics » Try Catch »

 

Exception Handling Fundamentals





C# exception handling is managed via four keywords: try, catch, throw, and finally.




    
try  {
                //  block  of  code  to  monitor  for  errors
        }
        catch  (ExcepType1  exOb)  {
                //  handler  for  ExcepType1  
        }
        catch  (ExcepType2  exOb)  {
                //  handler  for  ExcepType2  
        }
        .
        .
        finally{
        
        }
    
   
  
   

If no exception is thrown by a try block, no catch statements will be executed and program control resumes after the catch statement.



HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Language Basics
» Try Catch