Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 617 Bytes

RCS1165.md

File metadata and controls

37 lines (26 loc) · 617 Bytes

RCS1165: Unconstrained type parameter checked for null

Property Value
Id RCS1165
Category Usage
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)))
{
}

See Also

(Generated with DotMarkdown)