Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 651 Bytes

GCop434.md

File metadata and controls

43 lines (34 loc) · 651 Bytes

GCop 434

"Class name is unnecessary here. Static members can be called directly."

Rule description

You can access a static member in the same class by simply specifying its name directly.

Example

public class MyClass
{
    public int MyProperty
    {
        get { return Settings.MyMethod(); }
        set { MyProperty = value; }
    }  
  
    static void MyMethod()
    {
        ...
    }
}

should be 🡻

public class MyClass
{
    public int MyProperty
    {
        get { return MyMethod(); }
        set { MyProperty = value; }
    }  
  
    static void MyMethod()
    {
        ...
    }
}