Jump to content
Xtreme .Net Talk

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


Recommended Posts

Guest zequion1
Posted

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...