PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
{
// Check to see if the provider we get is a ReflectTypeDescriptionProvider.
// If so, we can call on it directly rather than creating another
// custom type descriptor
TypeDescriptionProvider p = _node.Provider;
ReflectTypeDescriptionProvider rp = p as ReflectTypeDescriptionProvider;
PropertyDescriptorCollection properties;
if (rp != null)
{
properties = rp.GetProperties(_objectType);
}
else
{
ICustomTypeDescriptor desc = p.GetTypeDescriptor(_objectType, _instance);
if (desc == null) throw new InvalidOperationException(SR.Format(SR.TypeDescriptorProviderError, _node.Provider.GetType().FullName, "GetTypeDescriptor"));
properties = desc.GetProperties(attributes);
if (properties == null) throw new InvalidOperationException(SR.Format(SR.TypeDescriptorProviderError, _node.Provider.GetType().FullName, "GetProperties"));
}
return properties;
}