Move Foo and Foo <T> with ReSharper to match files
the code
I would like to use the ReSharper Move Types Into Matching Files function to move the code below, which is written in one .cs
. File:
public abstract class Foo { } public abstract class Foo<T> : Foo { }
ReSharper refactoring throws this exception:
It is not possible to move the Foo class because there is another declaration that will be moved to the "Foo.cs" file.
Question
I can think of two results, of which either I'm fine:
- Move both
Foo
andToo<T>
toFoo.cs
- Move
Foo
toFoo.cs
and moveFoo<T>
toFooOfT.cs
So the question remains:
- Is there any other best naming practice that does not conflict with resharper ?, or
- Is there any way to configure ReSharper to support this name?
Note
- Because Generics are unique to every possible combination of constraints, the
Foo
class is my interface class. Therefore, I will not renameFoo<T>
toBar<T>
. - I do not want to rename
Foo
toFooBase
, since it is already an abstract class that makes the explicit suffix "Base" redundant. - I cannot reorganize
Foo
intoIFoo
, sinceFoo
is my conceptual interface (due to the necessary base implementation.
As far as I know, there is no way to tell Resharper to add general file name parameters. It will just use the class name, i.e. Foo
, Foo<T>
and Foo<A, B, C>
all have Foo.cs
as the file name, but - and that the problem is - ReSharper does not seem to know that this feature exists and will show you are mistaken in this scenario. In fact, you can do nothing with this except registering an error or requesting a function .