throw null;

Tags: ,
No Comments »

I found this somewhere and I think it’s worth to write a short (only a very short) entry.

throw null;

If you use this expression in your C# code it will throw a NullReferenceException. That is because the throw-statement needs an object of type Exception as its single parameter. But this very object is null in my example.

I like this way to produce some exception while testing code.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in