VB.NET 必须实现错误
问题描述:
我只是将 C# 函数转换为 VB.NET 函数,但不知何故我得到了一些错误.下面是我的 C# 函数.
I just convert the C# function to VB.NET function but somehow I get some error. Below is my C# function.
public abstract class BaseFilterControl: UserControl,IFilterControl
{
public string PropertyName { get; set; }
public FilterDescriptorBase AssociatedDescriptor { get; set; }
public bool IsFirst { get; set; }
public abstract FilterDescriptorBase BuildDescriptor();
protected abstract void Initialize();
}
下面是我当前的VB函数
Below is my current VB function
Public MustInherit Class BaseFilterControl
Inherits UserControl
Implements IFilterControl
Public Property PropertyName As String
Public Property AssociatedDescriptor As FilterDescriptorBase
Public Property IsFirst As Boolean
Public MustOverride Function BuildDescriptor() As FilterDescriptorBase
Protected MustOverride Sub Initialize()
End Class
我收到此错误:
BaseFilterControl must implement Function BuildDescriptor() As FilterDescriptorBase.
任何想法.请帮忙.谢谢
Any idea. Please help. Thanks
答
一个很好地实现接口方法的抽象方法.在VB中,只需要指定函数实现接口函数即可:
An abstract method implementing an interface method in fine. In VB, you just need to specify that the function implements the interface function:
Public MustOverride Function BuildDescriptor() As FilterDescriptorBase Implements IFilterControl.BuildDescriptor
您可能需要为其他方法添加更多Implements"子句 - 我不熟悉 IFilterControl 接口.
You might need to add more "Implements" clauses for other methods - I'm not familiar with the IFilterControl interface.