I have an interface defined in C# project:
public interface IForm
{
bool IsDisposed { get; }
void Show();
}
I implemented it in a C# class in WinForms
public partial class Form1 : Form, IForm { }
As the method Show() and property IsDisposed are already present in the System.Windows.Forms.Form class I do not require to implement it.
But same doesn't hold true in VB.NET, in VB.NET I have to define the members, otherwise getting compile error.
Public Class Form1
Implements WindowsFormsApplication1.IForm
Public ReadOnly Property IsDisposed1 As Boolean Implements WindowsFormsApplication1.IForm.IsDisposed
Get
End Get
End Property
Public Sub Show1() Implements WindowsFormsApplication1.IForm.Show
End Sub
End Class
Why do I have to define the interface members in VB.NET if they are already present in the base class ?
System.Windows.Form.Inherits Formstatement is in theForm1.Designer.vbfile.ShowandIsDisposedmembers in theFormclass with empty procedures (IsDisposed1,Show1)? In other words, now theShowandIsDisposedmembers of theForm1simply do nothing.