/// <devdoc> /// Returns a custom type descriptor for the given instance. /// Performs arg checking so callers don't have to. This /// will call through to instance if it is a custom type /// descriptor. /// </devdoc> internal static ICustomTypeDescriptor GetDescriptor(object component, bool noCustomTypeDesc) { if (component == null) { throw new ArgumentException("component"); } if (component is IUnimplemented) { throw new NotSupportedException(SR.GetString(SR.TypeDescriptorUnsupportedRemoteObject, component.GetType().FullName)); } ICustomTypeDescriptor desc = NodeFor(component).GetTypeDescriptor(component); ICustomTypeDescriptor d = component as ICustomTypeDescriptor; if (!noCustomTypeDesc && d != null) { desc = new MergedTypeDescriptor(d, desc); } return desc; }
internal static ICustomTypeDescriptor GetDescriptor(object component, bool noCustomTypeDesc) { if (component == null) { throw new ArgumentException("component"); } if (component is IUnimplemented) { throw new NotSupportedException(SR.GetString("TypeDescriptorUnsupportedRemoteObject", new object[] { component.GetType().FullName })); } ICustomTypeDescriptor typeDescriptor = NodeFor(component).GetTypeDescriptor(component); ICustomTypeDescriptor primary = component as ICustomTypeDescriptor; if (!noCustomTypeDesc && (primary != null)) { typeDescriptor = new MergedTypeDescriptor(primary, typeDescriptor); } return typeDescriptor; }