我只是将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中,您只需要指定该函数实现接口函数即可:

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


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

08-25 13:18
查看更多