How to refactor a type so it becomes a nested type? (C#)

It's easy to refactor a nested type via “Move to Outer Scope”. But how would I refactor an existing type to become a nested type of another class?

In this example, I want to refactor “MakeThisNested” to be a nested type in “Container”. There is no such context option:

The best I can do is to “Move Type to Another Namespace” and enter “Container” as the namespace, then move the “MakeThisNested” class manually and remove the “Container” namespace that the refactoring created. Obviously this isn't perfect and often results in several manual code adjustments.

Is there really no “Move to Inner Scope” refactoring where I can specify the target type?

1 comment

Hello Steffen,

Regrettably, this feature is not available in Rider yet. Please feel free to vote for RSRP-44434 to demonstrate your interest.


Please sign in to leave a comment.