为了账号安全,请及时绑定邮箱和手机立即绑定

关于c#/vb.net 的问题,如果list类型作为属性编译不通过的错误?

关于c#/vb.net 的问题,如果list类型作为属性编译不通过的错误?

开心每一天1111 2021-05-18 18:11:52
代码如下(vb.net)//Piece是我自定义的一个很简单的类。//这代码是在另外一个类里面Private m_Pieces As List(Of Piece)Public Property Pieces() As List(Of Piece)GetReturn m_PiecesEnd GetSet(ByVal value As List(Of Piece))m_Pieces = valueEnd SetEnd Property编译错误:Public Property Pieces As System.Collections.Generic.List(Of Piece)”和“Public Property Pieces As System.Collections.Generic.List(Of Procedure)”的差异仅在于返回类型,因此它们无法重载对方。英文版错误:You have attempted to overload a method with another method that differs from the first only in its return type. In overloading, you must differentiate any two versions of a method by their argument lists; you cannot use anything other than argument lists to differentiate the methods.
查看完整描述

1 回答

?
侃侃无极

TA贡献2051条经验 获得超10个赞

这个另外的类有一个基类吧,你重载了Pieces属性但是返回了与基类不同的类型,所以出错了

查看完整回答
反对 回复 2021-05-23
  • 1 回答
  • 0 关注
  • 262 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信