Re-order Generic Types Follow
I have a base class with multiple generic type parameters; many classes inherit from it. I've decided the ordering of the parameters doesn't make much sense (long story, not worth going into), and would like to re-order them. Does ReSharper have an analog to its "Change Signature" tool for method parameters that I could use here?
Please sign in to leave a comment.
Hello Mathomancer314
Would you like just to re-order the parameters order in your code using some UI dialog instead of the text editor?
Correct -- as in, a dialog that would automatically re-order the parameters in every subclass and instance used in my solution.
I've long since done it manually (it took hours), but I can't be the only one who occasionally faces this problem...
Mathomancer314 One more question. What do you mean by the class' parameters? Do you refer to the class' fields and properties ?
I mean the generic type parameters, as mentioned in the OP. So if I have:
public class MyBaseClass<T1,T2,T3> { ... }
public class MyDerivedClass1<T1,T2,T3,T4,T5> : MyBaseClass<T1,T2,T3> { ... }
public class MyDerivedClass2<T1,T2,T3,T6,T7> : MyBaseClass<T1,T2,T3> { ... }
public class Foo
{
private MyDerivedClass2<float,int,Foo,string,bool> myFooWrapper;
}
...and I decide that T3 should in fact come first in the list (e.g., for clarity to users of the API), I'd like a tool similar to the already-existing "Change [Method] Signature" which can automatically update all of the above to:
public class MyBaseClass<T3,T1,T2> { ... }
public class MyDerivedClass1<T3,T1,T2,T4,T5> : MyBaseClass<T3,T1,T2> { ... }
public class MyDerivedClass2<T3,T1,T2,T6,T7> : MyBaseClass<T3,T1,T2> { ... }
public class Foo
{
private MyDerivedClass2<Foo,float,int,string,bool> myFooWrapper;
}
Even better would be an option to add or remove generic type parameters. If all this seems like a niche case, I'll just say that to me, it seems exactly as useful (and in many of the same circumstances) as the original "Change Signature" tool.
Hello Mathomancer314
We have the feature request for this: https://youtrack.jetbrains.com/issue/RSRP-288544 Please feel free to comment and vote or just subscribe on the issue.