public static PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, Attribute[] attributes, object component, TypeConverter converter)
{
if (component == null) return null;
if (component is ICustomTypeDescriptor)
{
ICustomTypeDescriptor descriptor = (ICustomTypeDescriptor)component;
if (attributes != null)
return descriptor.GetProperties(attributes);
return descriptor.GetProperties();
}
// Note that this assumes that converter supports GetProperties!
if (converter != null)
{
return converter.GetProperties(context, component, attributes);
}
Type type = component.GetType();
if (attributes != null)
return TypeDescriptor.GetProperties(component, attributes);
return TypeDescriptor.GetProperties(component);
}