Classes in .net like List and Dictionary can be indexed directly, without mentioning a member, like this:
Dim MyList as New List (of integer)
...
MyList(5) 'get the sixth element
MyList.Items(5) 'same thing
How do I make a class that can be indexed like that?
Dim c as New MyClass
...
c(5) 'get the sixth whatever from c
You need to provide an indexer (C# terminology) or default property (VB terminology). Example from the MSDN docs:
VB: (
myStringsis a string array)And C# syntax: