Can I create a class in VB.NET that can be used with C # as follows:
myObject.Objects[index].Prop = 1234;
Of course, I can create a property that returns an array. But the requirement is that the index is based on 1, not 0, so this method must somehow match the indices:
I tried to do it like this, but C # told me that I cannot call it directly:
Public ReadOnly Property Objects(ByVal index As Integer) As ObjectData
Get
If (index = 0) Then
Throw New ArgumentOutOfRangeException()
End If
Return parrObjectData(index)
End Get
End Property
EDIT
Sorry if I'm a little unclear:
C # only allows me to call this method, for example
myObject.get_Objects(index).Prop = 1234
but not
myObject.Objects[index].Prop = 1234;
this is what I want to achieve.
source
share