It’s nice to be back here after a long hiatus due to project deadlines, non-stop coding and lots of caffeine intake. For today’s session, I would like to share a simple but helpful technique involving the different throw implementations for Try Catch statement. This technique helped me a lot especially when debugging an application or logging the errors encountered by an application.
So, what is the difference with the Throw statement, Throw ex statement and Throw new Exception ? In order for us to clearly grasp the concept let us take a look at the sample program below:
One important aspect to learn if you want to properly handle types in C# are Boxing and Unboxing. Boxing and Unboxing are just simple to use, but sometimes creates more problems rather than being helpful if not properly used. So lets discuss what are Boxing and Unboxing.
One cool feature that I found useful in C# are the so called Extension Methods. So what are Extension Methods you say ? Extension methods are in simple terms allows you to extend an existing type with additional functionality without having to modify the the old type.