Add to Interface
In This Article
Adds a method to an interface implemented by the current class. If the class implements several interfaces, the you should specify the interface to which the method will be added. The refactoring activates Linked Identifiers for the method references.
#Availability
Available from the context menu or via shortcuts:
- when the cursor is on a method name within the method declaration, provided that the current class implements an interface that does not include the method.
#Examples
internal interface ITestClass
{
}
class TestClass : ITestClass
{
public void │TestMethod(string str)
{
}
}
Interface ITestClass
End Interface
Class TestClass
Implements ITestClass
Public Sub │TestMethod(ByVal str As String)
End Sub
End Class
Result:
internal interface ITestClass
{
void │TestMethod(string str);
}
class TestClass : ITestClass
{
public void TestMethod(string str)
{
}
}
Interface ITestClass
Sub │TestMethod(ByVal str As String)
End Interface
Class TestClass
Implements ITestClass
Public Sub TestMethod(ByVal str As String) Implements ITestClass.TestMethod
End Sub
End Class