AttributeCollection ICustomTypeDescriptor.GetAttributes()
{
// 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;
if (rp != null)
{
return rp.GetExtendedAttributes(_instance);
}
ICustomTypeDescriptor desc = p.GetExtendedTypeDescriptor(_instance);
if (desc == null) throw new InvalidOperationException(SR.Format(SR.TypeDescriptorProviderError, _node.Provider.GetType().FullName, "GetExtendedTypeDescriptor"));
AttributeCollection attrs = desc.GetAttributes();
if (attrs == null) throw new InvalidOperationException(SR.Format(SR.TypeDescriptorProviderError, _node.Provider.GetType().FullName, "GetAttributes"));
return attrs;
}