In c# I can write the following piece of code:
public class SomeClass
{
public interface IMyInterface
{
DialogResult ShowDialog();
}
}
public partial class Form1 : Form, SomeClass.IMyInterface
{
}
This works because c# automatically “maps” the ShowDialog()
method of the interface to the method with the same name implemented in Form
.
In VB I have to explicitly declare that a method in the class implements an interface method:
Public Function ShowDialog() As DialogResult Implements SomeClass.ShowDialog
'...
End Function
But this way I’m redefining an already defined method.
Of course I can create a helper function:
Public Function IMyInterface_ShowDialog() As DialogResult Implements SomeClass.ShowDialog
Return ShowDialog()
End Function
but I wonder if this is the best practice in this case, or if I can somehow refer to the already implemented method.
3