VB.NET必须实现错误

本文关键字:实现 错误 NET VB | 更新日期: 2023-09-27 18:00:56

我只是将C#函数转换为VB.NET函数,但不知何故我遇到了一些错误。下面是我的C#函数。

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函数

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.

任何想法。请帮忙。感谢

VB.NET必须实现错误

一个抽象方法,实现了一个接口方法。在VB中,您只需要指定函数实现接口函数:

Public MustOverride Function BuildDescriptor() As FilterDescriptorBase Implements IFilterControl.BuildDescriptor

您可能需要为其他方法添加更多的"Implements"子句——我不熟悉IFilterControl接口。