Reorder Type Member by member access modifier
Hi guys,
Is it possible with Resharper 5 to reorder type members first by access modifier then by member type. E.g.
class A
{
// privates
private int a1;
private void Method1() {}
private int Prop1 { get; set;}
// protected
protected int a2;
protected void Method2() {}
protected int Prop2 { get; set;}
// public
public int a3;
public void Method3() {}
public int Prop3 { get; set;}
}
If it is possible, how should I write my script to do so.
Thanks.
Please sign in to leave a comment.
Hello Alex,
In order to sort matched members by access modifier you can add section for each pattern in ReSharper
| Options | ReSharper | Languages | C# | Type Member Layout. Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hi Andrey,
Can you please clarify what do you mean?
I know that Reordering is performed via ReSharper | Options | ReSharper | Languages | C# | Type Member Layout section and I know how to sort first by type member, then by access modifier.
But i have no idea, how to sort first by Access modifier, then by type member.
Thanks.
Is it possible?
Hello Alex,
Sorry for delayed response! This should be possible if you create a single
tag of that entry: this should make ReSharper
sort all members by access modifier and then sort them by name. Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hi Andrey,
Can you please clarify what do you mean by sample of the configuration xml?
Thanks.
Hello Alex,
As an example you can remove all
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
What "all" should be removed?
Hello Alex
I'm attaching a full type member layout xml file that you can use. Let me know if this helps. Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Attachment(s):
order_by_access_and_name.xml
Thank you, it is clear now.