R
Ray Cassick \(Home\)
I am trying to create a generic logging component that will accept an
exception object and create a string containing all the properties and their
values available for a specific exception.
My intent here is try to create a generic function that will be able to:
- Take a an object of type Exception...
- Iterate through all the properties the object has...
- Add the property names to a stringbuilder...
- Call each of the properties and get the values...
- Add each of the values to the string builder.
I can get all the basic properties that System.Exception provides (Message,
Source, Inner Exception, Target Site, Stack Trace, etc...) but I would also
like to be bale to get any customer properties provided by the more specific
exceptions and also print them out.
Can anyone point me to a piece of code that will help? I would also like to
be able to print the specifics on custom exceptions that are not part of the
framework but I am thinking that I am not going to be able to get much
deeper than the standard properties provided by the base exception the
custom exception inherits from.
Any ideas out there?
exception object and create a string containing all the properties and their
values available for a specific exception.
My intent here is try to create a generic function that will be able to:
- Take a an object of type Exception...
- Iterate through all the properties the object has...
- Add the property names to a stringbuilder...
- Call each of the properties and get the values...
- Add each of the values to the string builder.
I can get all the basic properties that System.Exception provides (Message,
Source, Inner Exception, Target Site, Stack Trace, etc...) but I would also
like to be bale to get any customer properties provided by the more specific
exceptions and also print them out.
Can anyone point me to a piece of code that will help? I would also like to
be able to print the specifics on custom exceptions that are not part of the
framework but I am thinking that I am not going to be able to get much
deeper than the standard properties provided by the base exception the
custom exception inherits from.
Any ideas out there?