You can get a complete list of indexed properties, and the names of the keys that are used to index them, with code like this:
var list = System.AppDomain.CurrentDomain.GetAssemblies()
.SelectMany
(
a => a.GetTypes().SelectMany
(
t => t.GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)
.Where
(
p => p.GetIndexParameters().Length > 0
)
.Select
(
prop => string.Format
(
"{0}.{1}[{2}]",
t.FullName,
prop.Name,
string.Join
(
",",
prop.GetIndexParameters().Select(ip => ip.Name)
)
)
)
)
);
If you look through the list, you'll see the vast, vast majority have an indexed parameter named "index" or "key." So it seems that is indeed the majority use case.
In some pretty rare cases you'll see some alternative uses. For example, there is a private class within XmlToDataSetMap
(source) that accepts a several alternative "keys" (an XmlDataReader, for example, or a DataTable) which do not act as a key but do serve to populate a key (e.g. by copying some properties into a different object which is then used as an indexer key). But the property is still named Item[]
and the overall concept is one of containing a collection, and indeed, the class inherits from HashTable
.
(On a side note, XmlToDataSetMap
also contains another private class , XmlNodeIdentety
, whose name contains the only blatant misspelling I've ever seen in the CLR. So maybe we don't want to follow the example of whoever wrote this class.)