[英]Convert InnerList from Vb to c#
I am trying to convert some VB code to C#; 我正在尝试将一些VB代码转换为C#; however I'm having some trouble,
但是我遇到了麻烦
Here is my VB code: 这是我的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
And I used a converter and here is the result: 我使用了一个转换器,结果如下:
C# C#
public BiometrikBilgi this[int index]
{
get { return base.InnerList[index]; }
set { base.InnerList[index] = value; }
However in get {} line compiler gives error it says ; 但是在get {}行中,编译器给出了错误,它说:
Cannot implicitly convert type 'object' to 'BiometrikBilgi'.
无法将类型'object'隐式转换为'BiometrikBilgi'。 An explicit conversion exists (are you missing a cast?)
存在显式转换(您是否缺少演员表?)
How can I fix this issue? 如何解决此问题?
The value of base.InnerList[index]
is apparently an object
type, but your property returns a BiometrikBilgi
. base.InnerList[index]
值显然是object
类型,但是您的属性返回BiometrikBilgi
。
Try casting the value you're returning: 尝试转换要返回的值:
get { return (BiometrikBilgi)base.InnerList[index]; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.