This project is read-only.

AV1570 Check as for null


An addition to this:

Using the 'as' is more performance when you expect that the object may be of another type. But then you must also expect the null result. If you don't expect another type, always cast with parentheses. If it is another type, a meaningful InvalidCastException will be thrown. (Which, together with try/catch, on the other side is slower than the 'as' operator.)


dennisdoomen wrote Jun 25, 2015 at 7:35 PM

We've moved. Please post any issues at