Purpose
Moves a member with its dependencies to a base type.
Availability
Available when the caret is in a type member. The base type code should exist in the current solution.
Note
This refactoring is not available for interfaces.
Usage
Place the caret in a member declaration.
class BaseClass {
}
class MyBaseClass : BaseClass {
}
class MyClass : MyBaseClass {
public void IncrementValue(int interval) {
Value += interval;
}
public int Value { get; set; }
}
Class BaseClass
End Class
Class MyBaseClass
Inherits BaseClass
End Class
Class [MyClass]
Inherits MyBaseClass
Public Sub IncrementValue(ByVal interval As Integer)
Value += interval
End Sub
Public Property Value As Integer
End Class
- Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.
Select Pull Member Up from the menu. If there are several base types in the current solution, you can select the target type from the submenu.
After execution, the Refactoring moves a member with its dependencies to a base type.
class BaseClass {
public void IncrementValue(int interval) {
Value += interval;
}
public int Value { get; set; }
}
class MyBaseClass : BaseClass {
}
class MyClass : MyBaseClass {
}
Class BaseClass
Public Sub IncrementValue(ByVal interval As Integer)
Value += interval
End Sub
Public Property Value As Integer
End Class
Class MyBaseClass
Inherits BaseClass
End Class
Class [MyClass]
Inherits MyBaseClass
End Class