Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 487 Bytes

RCS1165.md

File metadata and controls

32 lines (23 loc) · 487 Bytes

RCS1165: Unconstrained type parameter checked for null

Property Value
Id RCS1165
Severity Hidden

Example

Code with Diagnostic

public void Foo<T1>() where T1 : new()
{
    var x = default(T1);

    if (x == null) // RCS1165
    {
    }
}

Code with Fix

if (EqualityComparer<T1>.Default.Equals(x, default(T1)))
{
}

(Generated with DotMarkdown)