NullReferenceException is a common exception that has been experienced by most programmers. It is thrown when an attempt is made to access a property or method on a null object.
To defend against computer program crashes, the common course of action among fellow programmers is to use try{...}catch (NullReferenceExceptionre){...} blocks. This is a part of defensive programming. But the problem is that, a lot of the time, the error is simply logged and rethrown. Besides this, a lot of wasted computations are performed that could have been avoided.
A much better way of handling ArgumentNullExceptions is to implement ArgumentNullValidator. The parameters of a method are usually the source of a null object. It makes sense to test the parameters of a method before they are used and, if they are found to be invalid for any reason, to throw an appropriate Exception. In the case of ArgumentNullValidator, you would place this validator at the...