I think ICustomTypeProvider is newer than ICustomTypeDescriptor and easier to implement Dynamic Properties.
As a suggestion, a very little modification could enable the support of it:
protected static List<PropertyDescriptor> GetPropertyDescriptors(object instance)
{
PropertyDescriptorCollection descriptors;
TypeConverter tc = TypeDescriptor.GetConverter(instance);
if (tc == null || !tc.GetPropertiesSupported())
{
if (instance is ICustomTypeDescriptor)
{
descriptors = ((ICustomTypeDescriptor)instance).GetProperties();
}
else if (instance is ICustomTypeProvider)
{
descriptors = TypeDescriptor.GetProperties(((ICustomTypeProvider)instance).GetCustomType());
}
else
{
descriptors = TypeDescriptor.GetProperties(instance.GetType());
}
}
else
{
descriptors = tc.GetProperties(instance);
}
return (descriptors != null)
? descriptors.Cast<PropertyDescriptor>().ToList()
: null;
}
Comments: Dupplicate of 22045
As a suggestion, a very little modification could enable the support of it:
protected static List<PropertyDescriptor> GetPropertyDescriptors(object instance)
{
PropertyDescriptorCollection descriptors;
TypeConverter tc = TypeDescriptor.GetConverter(instance);
if (tc == null || !tc.GetPropertiesSupported())
{
if (instance is ICustomTypeDescriptor)
{
descriptors = ((ICustomTypeDescriptor)instance).GetProperties();
}
else if (instance is ICustomTypeProvider)
{
descriptors = TypeDescriptor.GetProperties(((ICustomTypeProvider)instance).GetCustomType());
}
else
{
descriptors = TypeDescriptor.GetProperties(instance.GetType());
}
}
else
{
descriptors = tc.GetProperties(instance);
}
return (descriptors != null)
? descriptors.Cast<PropertyDescriptor>().ToList()
: null;
}
Comments: Dupplicate of 22045