G
Guest
Is there some generic property that will give me the name of a function
within its catch block?
within its catch block?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Is there some generic property that will give me the name of a function
within its catch block?
AA2e72E said:Is there some generic property that will give me the name of a function
within its catch block?
You can use the StackTrace class - but don't start building stack
traces in performance critical code.
Mark said:What about this: ?
http://msdn2.microsoft.com/en-us/library/system.reflection.methodbase.getcurrentmethod.aspx
Are there any performance issues with that...?
Mark Rae said:What about this: ?
http://msdn2.microsoft.com/en-us/library/system.reflection.methodbase
.getcurrentmethod.aspx
Are there any performance issues with that...?

Arne said:It is in System.Slow namespace, so with sufficient many calls
it could be a performance problem.
It is probably faster than StackTrace though.
AA2e72E said:I have a single error reporting method that takes the exception variable as
its argument; so I don't know which method caused the exception but as
detailes in the Jon Skeet's post, the exception variable holds the name.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.