I've been trying to get ReSharpers Code Cleanup to not only sort any members alphabetically by name, but to sort them primarily by their type (whether that be a methods return type or a properties type etc.), then by their name.

For example:

#region " Properties "

public string Name { get; set; }
public int Age { get; set; }

#endregion

#region " Instance Methods "

public void SecondMethod()...
public void FirstMethod()...
public Post GetPost()...
public List<Post> GetPosts()...

#endregion

Would become:

#region " Properties "

public int Age { get; set; }
public string Name { get; set; }

#endregion

#region " Instance Methods "

public List<Post> GetPosts()...
public Post GetPost()...
public void FirstMethod()...
public void SecondMethod()...

#endregion

Ideally, I would like the other default behaviours to remain the same e.g. where Constructors, Properties are positioned/grouped, and if a number of members appear within a region (as in the example above), for that group of members to be sorted independently from members outside of that group/region.

Can anyone recommend the code necessary within the ReSharper Type Members Layout pattern editor to achieve this please?

Edit
Report