VB.NET 必须实现错误 [英] VB.NET must implement error

查看:38
本文介绍了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.

这篇关于VB.NET 必须实现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆