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.
9 comments

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 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.

---
Original message URL:
http://devnet.jetbrains.net/message/5320900#5320900



0

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.

0

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!"

Is it possible?

---
Original message URL:
http://devnet.jetbrains.net/message/5321891#5321891



0

Hi Andrey,

marcus23 wrote:

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.  


Can you please clarify what do you mean by sample of the configuration xml?

Thanks.

0

Hello Alex,

As an example you can remove all

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Hi Andrey,

marcus23 wrote:
> 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.
>

Can you please clarify what do you mean by sample of the configuration
xml?

Thanks.

---
Original message URL:
http://devnet.jetbrains.net/message/5322050#5322050



0

marcus23 wrote:

Hello Alex,

As an example you can remove all

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc


What "all" should be removed?

0

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
0

Please sign in to leave a comment.