Short answer, no - you can't get at indexers via TypeDescriptor
Longer answer - why you can't - deep down in the bowels of the TypeDescriptor
mess-o-classes, there is the reflective call to aggregate properties for the GetProperties
call. In there is this code:
for (int i = 0; i < properties.Length; i++)
{
PropertyInfo propInfo = properties[i];
if (propInfo.GetIndexParameters().Length <= 0)
{
MethodInfo getMethod = propInfo.GetGetMethod();
MethodInfo setMethod = propInfo.GetSetMethod();
string name = propInfo.Name;
if (getMethod != null)
{
sourceArray[length++] = new ReflectPropertyDescriptor(type, name, propInfo.PropertyType, propInfo, getMethod, setMethod, null);
}
}
}
The important part there is the check for 0 index parameters - if it has an indexer, it skips it. :(