private static PropertyDescriptorCollection GetListItemPropertiesByEnumerable(IEnumerable enumerable, PropertyDescriptor[] listAccessors) {
PropertyDescriptorCollection pdc = null;
if ((null == listAccessors) || (listAccessors.Length == 0)) {
pdc = GetListItemPropertiesByEnumerable(enumerable);
}
else {
ITypedList typedList = enumerable as ITypedList;
if (typedList != null) {
pdc = typedList.GetItemProperties(listAccessors);
}
else {
// Walk the tree
pdc = GetListItemPropertiesByEnumerable(enumerable, listAccessors, 0);
}
}
return pdc;
}