c# - Can you get Method name that threw Exception? -


is there c# method returns upper-most caller, name of my method threw exception, if actual exception thrown (e.g. database driver errors when method calls it) ?

caller -> mymethod -> dbdriver(error)

i want "mymethod", not "dbdriver"

i'd rather not re-throw exceptions way chain.

my current kludge, iterate through stacktrace frames, , parse out method using methodbase.getcurrentmethod().declaringtype.

is there built-in method information or more elegant solution?

thanks!

use exception.targetsite property method name

gets method throws current exception.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -