Use custom exceptions to add information that will be more meaningful to your users when exceptions occur. And, you still can maintain all the information from the original exception.
Articles Written by Jay Miller
.NET Tip: Type Casting and Comparison Using "as" and "is"
Use some of the language's lesser known features for safe type casting and comparison.
.NET Tip: Throwing Exceptions: Will You be Able to Catch What You Expect?
Handling exceptions can sometimes be a little tricky. If you are not careful, your code may act on the wrong information. Learn how to bubble up exceptions while keeping the original exception information intact.
.NET Tip: Data Encapsulation: Using Properties Instead of Public Variables
Here is encapsulation, one of the very basic tenets of object-oriented programming. Using properties instead of public variables helps insulate the users of your class from change, provides you more flexibility, and will ease maintenance of your class.
.NET Tip: Debugging: Dynamically Determining the Name of the Current Function
Are you tired of hard-coding function names in trace messages? Have you ever used cut and paste to copy a trace statement and forgot to change the function name? There'll be no more wild goose chases because of bad function names when you determine the function name dynamically.
.NET Tip: Implement IDisposable to Ensure Your Objects Clean Up After Themselves
Be a good resource citizen by implementing IDisposable. You will be able to ensure that your objects have the opportunity to release all of their managed and unmanaged resources.
