2
Reply

What is Try-Catch in .net?

Brijesh Jalan

Brijesh Jalan

Jul 15, 2010
5.3k
0

    A Try Catch in .Net or any programming language main purpose is to handle the exceptions in a structured manner.
    Try
    {
     // We write the code to be executed
    }
    Catch(Exception Ex)
    {
         // To Handle the error
    }
    Catch(Exception Ex)
    {
        // To Handle Multiple exceptions of different types
    }

    If any error got handled then the execution exists or checks the next exception in nested block or also Nested Error ExceptionHandling
    Exception is the base Class for ExceptionHandling .For custom Exception handling in the application we need to inherit from BaseClass i.e., Exception

    Examples : IndexOutOfRangeException
    InvalidCastException
    ArgumentOutOfRangeException
    NullReferenceException

    Sriram D
    July 19, 2010
    0

    Static class contain only static members(like variables,methods) on it.

    Veerareddy pallela
    July 19, 2010
    0