Simplify member access (IDE0002)

Property Value
Rule ID IDE0002
Title Simplify member access
Category Style
Subcategory Unnecessary code rules
Applicable languages C# and Visual Basic

Overview

This rule concerns use of simplified type member access in declarations and executable code, when possible. Unnecessary qualification can be removed to simplify code and improve readability. This rule has no associated code style option.

Example

static void M1() { }
static void M2()
{
    // IDE0002: 'C.M1' can be simplified to 'M1'
    C.M1();

    // Fixed code
    M1();
}
Shared Sub M1()
End Sub

Shared Sub M2()
    ' IDE0002: 'C.M1' can be simplified to 'M1'
    C.M1()

    ' Fixed code
    M1()
End Sub

See also