Jon,
I believe Michael is referring to the fact that VB.NET supports properties
that accept parameters, effectively defining named indexers.
In VB.NET one can do:
Public Class Person
Private m_name As HashTable
Public Property Name(index As String) As String
Get
Return m_name(index)
End Get
Set(ByVal value As String)
m_name (index) = value
End Set
End Property
Public Property PhoneNumber(index As Integer) As String
... ' similar to the Name property
Public Property Address(index As Integer) As String
... ' similar to the Name property
' This property is the same as C#'s indexer
' you can use either obj.Item(0) or obj(0) to get the value
Default Public Property Item(index As Integer) As String
...
End Class
Where the "index" parameter can be any type, and you can define more then
one "index" parameter (multi-dimension constructs).
Then I can use it as:
Dim aPerson As Person
aPerson.Name("First") = "Jay"
aPerson.Name("Middle") = "B"
aPerson.Name("Last") = "Harlow"
aPerson.PhoneNumber(0) = "1234"
aPerson.PhoneNumber(1) = "4321"
aPerson.Name(0) = "My home address"
aPerson.Name(1) = "My street address"
aPerson(0) = "item 1"
aPerson(1) = "item 2"
Which is what the OP wants, that C# does not support, however VB.NET does
support.
Hope this helps
Jay
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Michael Culley <mc*****@NOSPAMoptushome.com.au> wrote: You are correct, I must have been confusing it with properties
where vb.net can have any number of params and C# can only have none.
What exactly do you mean by this? Properties don't have *any*
parameters, unless you're talking about the value of the setter - in
which case, what does VB.NET do if you tell it to set a single property
to multiple values?
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too