Skip to content

Latest commit

 

History

History
11 lines (9 loc) · 412 Bytes

MA0131.md

File metadata and controls

11 lines (9 loc) · 412 Bytes

MA0131 - ArgumentNullException.ThrowIfNull should not be used with non-nullable types

ArgumentNullException.ThrowIfNull should not be used with non-nullable value, such as int or bool.

void Sample(int value, string str)
{
    ArgumentNullException.ThrowIfNull(value); // non-compliant as int is not nullable
    ArgumentNullException.ThrowIfNull(str); // ok as string is a reference type
}