Hi.
I'd want to know if it is possible in C # to declare one property analogous
to following (written in VB):
Property PropertyName (ByVal Index As Integer) As Object
Get
Return List.Item(Index)
End Get
Set (ByVal Value As Object)
List.Item(Index) = Value
End Set
End Property
(where List is an object of class CollectionBase).
The problem resides in the fact that in C # I don't succeed to declare a
property that receives a parameter (in this case an integer, but in a
generalized manner whichever type of object).
I've seen that an analogous thing can be made through indexer, but in the
case I want to pass more than one parameter or a parameter that isn't an
Integer?
More faster, someone can tell me why this translantion in C# of that VB code
fragment doesn't work?
public Object PropertyName (int Index) {
get {
return List.Item(Index);
}
set {
List.Item(Index)=value;
}
}
Thanks everyone.
Hi.
Roberto Sartori.