开发者

Make ReSharper reformat code according to StyleCop rule SA1206: The 'static' keyword must come before the 'other' keyword in the element declaration

开发者 https://www.devze.com 2023-01-09 08:40 出处:网络
I suspect I should create a pattern in ReSharper / Options / Languages / C# / Formatting Style / Type Membership Layout for this. I am currently using the default pattern and I would like some help fr

I suspect I should create a pattern in ReSharper / Options / Languages / C# / Formatting Style / Type Membership Layout for this. I am currently using the default pattern and I would like some help from someone who is good at them.

I want this to be WRONG:

public new static Age Empty {
    get {
        return empty;
    }

    set {
        empty = value;
    }
}

And this to be right:

public static new Age Empty {
    get {
     开发者_Python百科   return empty;
    }

    set {
        empty = value;
    }
}

In other words, I want static to come before other keywords, like new. Currently ReSharper 5.1 does it the "wrong" way.


ReSharper now has the possibility to configure the arrangement of modifiers.

Open the ReSharper options and go to Code Editing | C# | Code Style. In the Modifiers section Modifiers order you can reorder the arrangement according to your needs (see ReSharper online help: Arranging Modifiers).

To satisfy StyleCop's rule SA1206 move the static modifier above the new modifier:

Make ReSharper reformat code according to StyleCop rule SA1206: The 'static' keyword must come before the 'other' keyword in the element declaration


It is impossible.

0

精彩评论

暂无评论...
验证码 换一张
取 消