You must Sign In to post a response.
  • Category: .NET

    Exception in c# application

    we have a piece of code which generates nullreference exception. In the exception handling block, we have the general exception first and then the nullreference exception. Will this code work? If it does how exactly will it function?
  • #769863
    post your code here.. for detailed solution so it wont make confusion.

    you can use particular exception block to check then have general exception
    Like below
    try
    {
    --you code--
    }
    catch(NullReferenceException ner)
    {
    --handle exception here
    }
    catch(Exception e)
    {
    --handle exception here
    }

    Having general exception checking then particular exception is wrong mechanism.


  • Sign In to post your comments