Code
I would like to use the ReSharper Move Types Into Matching Files functionality to move the code below which is written in a single .cs
'. file:
public abstract class Foo
{
}
public abstract class Foo<T> : Foo
{
}
Executing the ReSharper refactoring causes this exception:
Can not move class Foo because there is another declaration that will be moved into file 'Foo.cs'.
Question
I can think of two outcomes of which either are ok by me:
- Move both
Foo
andToo<T>
intoFoo.cs
- Move
Foo
intoFoo.cs
and moveFoo<T>
intoFooOfT.cs
So, the question remains:
- Is there another best naming practise that does not conflict with resharper?, or
- Is there a way to configure ReSharper to support this naming?
Note
- Because Generics are unique for each possible combination of constraints, the
Foo
class is my interface class. Therefore I won't renameFoo<T>
toBar<T>
. - I do not wish to rename
Foo
toFooBase
as it is already an abstract class which makes the explicit 'Base' suffix redundant. - I cannot refactor
Foo
toIFoo
asFoo
is my conceptual interface (because of a required basic implementation.
As far as I know, there is no way to tell Resharper to append the generic parameters of the filename. It will just use the class name, i.e.
Foo
,Foo<T>
andFoo<A, B, C>
all haveFoo.cs
as the filename, but - and that's the problem - ReSharper doesn't seem to know that this possibility exists and will show you an error in this scenario. Really nothing you can do about it except logging a bug or feature request.