Sort arguments and properties

I have a lot of classes that takes different amounts of arguments in their constructor and the asigns them to properties. After a lot of coding and changes, these might start to get misaligned. 

 

In one class i might have 

new class1(id,name,adress)

and in another class I might have 

new class2(name,id,adress,zip)

 

And these classes also have their properties and assignments unordered.

So class1 might look like this

public class1(string id, strind name, string adress){

Id=id;

Name=name;

Adress = adress;

}

public string Name { get; }

public string Id { get; }

public string Adress { get; }

And so on. Is there a feature to effectively sort properties by looking at the constructor for example?

 

 

1 comment
Comment actions Permalink

Hello Anton,

 

thank you for contacting us.

There's no such option in ReSharper. I'd submit a feature request in our tracker - https://youtrack.jetbrains.com/issues/RSRP, but I'm not sure that fully understand the expected behavior.

Could you please provide code samples how it should work before and after sorting?

Should properties be sorted according to constructor parameters or according to their declaration order?

Thank you.

0

Please sign in to leave a comment.