try catch is slow and more slow if you are trying to retrieve the "Number" property

  • Thread starter Thread starter zequion1
  • Start date Start date
Z

zequion1

Guest
When an error occurs in any of my functions, execution is sent to a function that composes the error message.Many errors are not important and should not be displayed on the screen. imagine for example a loop where an error frequently occurs.

The problem is that when I want to retrieve the "Number" property, if it doesn't exist in the exception type, an added try catch is produced which slows down the execution even more.How can I tell if the exception has "Number" without fires try catch?

Function example (resume):

public static dynamic Fcn_Error_Excepcion(dynamic ErrorExcp)
{ try
{ if (ErrorExcp is System.Exception)
{ // IF NOT EXISTS ErrorExcp.Number Try catch fires which slows down more the error checking.
try{ Error_Number = ErrorExcp.Number; }catch(System.Exception ErrorExcp){}
}
}
}

Continue reading...
 
Back
Top