【发布时间】:2014-02-10 12:51:54
【问题描述】:
我正在尝试将一些 VB 代码转换为 C#;但是我遇到了一些麻烦,
这是我的 VB 代码:
Default Public Property Item(ByVal index As Integer) As BiometrikBilgi
Get
Return MyBase.InnerList(index)
End Get
Set(ByVal value As BiometrikBilgi)
MyBase.InnerList(index) = value
End Set
End Property
我使用了转换器,结果如下:
C#
public BiometrikBilgi this[int index]
{
get { return base.InnerList[index]; }
set { base.InnerList[index] = value; }
但是在 get {} 行编译器给出错误它说;
无法将类型“object”隐式转换为“BiometrikBilgi”。存在显式转换(您是否缺少演员表?)
我该如何解决这个问题?
【问题讨论】:
-
我该如何解决这个问题? 无意冒犯,但是您阅读了错误消息吗?它告诉您您缺少从
object到BiometrikBilgi的演员表:-)