DRY the throwing of ArgumentNullException("ParameterName")? I am using this code in a lot of places:

if (ParameterName == null)
{
    throw new ArgumentNullException("ParameterName");
}


But I think this is not DRY. The only difference here is ParameterName. Is it ok to use these lines everywhere, or is there a way to make it DRY?
Google Guava's Precondition class contains good patterns for this problem. For example, the checkNotNull method is the following:

T checkNotNull(T reference, String errorMessageTemplate, Object... errorMessageArgs)


Usage:

checkNotNull(parameter, "parameter cannot be null");


Note its return value. If the value is not null it returns the referencce, so you can use it in the following way:

public MyClass(MyObject dependency) {
    this.dependency = checkNotNull(dependency, "dependency cannot be null");
}


It also supports error message templates with %s.

Although it's a Java library, you can implement the same methods in C# too, they are really simple.

See also: Preconditions Explained