I want to create an error class. And it has some static properties. For example: Message , InnerException , Stacktrace , Source . But I want to add some dynamic properties.
If the exception is FileNotFoundException , I want to add the FileName property.
Or, if it is a SqlException , I want to add the LineNumber property. And I cannot inherit this class from Exception because I am returning this class from a web service. How can i do this?
c # class exception-handling
cagin
source share