• Top Posts

    Write down the C# syntax to catch an exception in C# ?


    • To catch an exception, we use try-catch blocks. Catch block can have a parameter of system.Exception type.

     {
        GetAllData();
    } 
    catch (Exception ex) {
    }
    
    • In the above example, we can omit the parameter from catch statement.

    No comments

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728