Mortimer,
The indexer is the only thing on a class that can be called by default.
Personally, I think that it is very dangerous to have such a thing (not
indexers, but default properties), because it creates ambiguities in the
code. One of my biggest pet peeves was ADO, when using a recordset, you
could do:
' pobjRs is an ADODB.Recordset
pobjRs("fieldName")
Where the above is shorthand for:
pobjRs.Fields.Item("fieldName").Value
The latter piece of code gives a much better idea of what the intent is,
IMO.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Mortimer Schnurd" <fu**********@hotsmail.com> wrote in message
news:dg********************************@4ax.com...
In VB, I could assign a "Default" to a class method. In that way, a
reference to the Class always returns the result of that
method/property (i.e. a reference to a textbox control always returns
the contents of textbox.text).
What is the C# equivalent? Is it the Indexer for that class?
--
John Wood