S
shapper
Hello,
I am trying to convert some of my old VB.NET code to C# using an
online tool but I am getting an error:
Default Public Overloads Property Item(ByVal index As Integer)
As Element
Get
Return TryCast(MyBase.BaseGet(index), Element)
End Get
Set(ByVal value As Element)
If MyBase.BaseGet(index) IsNot Nothing Then
MyBase.BaseRemoveAt(index)
End If
Me.BaseAdd(index, value)
End Set
End Property ' Item
Becomes:
public ConfigElement Item {
get { return base.BaseGet(index) as ConfigElement; }
set {
if (base.BaseGet(index) != null) {
base.BaseRemoveAt(index);
}
this.BaseAdd(index, value);
}
}
index disappears as input. Can't I use it?
Thanks,
Miguel
I am trying to convert some of my old VB.NET code to C# using an
online tool but I am getting an error:
Default Public Overloads Property Item(ByVal index As Integer)
As Element
Get
Return TryCast(MyBase.BaseGet(index), Element)
End Get
Set(ByVal value As Element)
If MyBase.BaseGet(index) IsNot Nothing Then
MyBase.BaseRemoveAt(index)
End If
Me.BaseAdd(index, value)
End Set
End Property ' Item
Becomes:
public ConfigElement Item {
get { return base.BaseGet(index) as ConfigElement; }
set {
if (base.BaseGet(index) != null) {
base.BaseRemoveAt(index);
}
this.BaseAdd(index, value);
}
}
index disappears as input. Can't I use it?
Thanks,
Miguel