/// <summary> /// This method returns an extended custom type descriptor for the given object. /// An extended type descriptor is a custom type descriptor that offers properties /// that other objects have added to this object, but are not actually defined on /// the object. For example, in the .NET Framework Component Model, objects that /// implement the interface IExtenderProvider can "attach" properties to other /// objects that reside in the same logical container. The GetTypeDescriptor /// method does not return a type descriptor that provides these extra extended /// properties. GetExtendedTypeDescriptor returns the set of these extended /// properties. TypeDescriptor will automatically merge the results of these /// two property collections. Note that while the .NET Framework component /// model only supports extended properties this API can be used for extended /// attributes and events as well, if the type description provider supports it. /// </summary> public virtual ICustomTypeDescriptor GetExtendedTypeDescriptor(object instance) { if (_parent != null) { return(_parent.GetExtendedTypeDescriptor(instance)); } return(_emptyDescriptor ?? (_emptyDescriptor = new EmptyCustomTypeDescriptor())); }
/// <summary> /// This method returns a custom type descriptor for the given type / object. /// The objectType parameter is always valid, but the instance parameter may /// be null if no instance was passed to TypeDescriptor. The method should /// return a custom type descriptor for the object. If the method is not /// interested in providing type information for the object it should /// return base. /// /// This method is prototyped as virtual, and by default returns a /// custom type descriptor that returns empty collections for all values /// if no parent provider was passed. If a parent provider was passed, /// this method will invoke the parent provider's GetTypeDescriptor /// method. /// </summary> public virtual ICustomTypeDescriptor GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object instance) { if (_parent != null) { return(_parent.GetTypeDescriptor(objectType, instance)); } return(_emptyDescriptor ?? (_emptyDescriptor = new EmptyCustomTypeDescriptor())); }
public virtual ICustomTypeDescriptor GetExtendedTypeDescriptor (object instance) { if (_parent != null) return _parent.GetExtendedTypeDescriptor (instance); if (_emptyCustomTypeDescriptor == null) _emptyCustomTypeDescriptor = new EmptyCustomTypeDescriptor (); return _emptyCustomTypeDescriptor; }
/// <summary>Gets a custom type descriptor for the given type and object.</summary> /// <returns>An <see cref="T:System.ComponentModel.ICustomTypeDescriptor" /> that can provide metadata for the type.</returns> /// <param name="objectType">The type of object for which to retrieve the type descriptor.</param> /// <param name="instance">An instance of the type. Can be null if no instance was passed to the <see cref="T:System.ComponentModel.TypeDescriptor" />.</param> public virtual ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { if (_parent != null) { return(_parent.GetTypeDescriptor(objectType, instance)); } if (_emptyCustomTypeDescriptor == null) { _emptyCustomTypeDescriptor = new EmptyCustomTypeDescriptor(); } return(_emptyCustomTypeDescriptor); }
public virtual ICustomTypeDescriptor GetExtendedTypeDescriptor(object instance) { if (this._parent != null) { return(this._parent.GetExtendedTypeDescriptor(instance)); } if (this._emptyDescriptor == null) { this._emptyDescriptor = new EmptyCustomTypeDescriptor(); } return(this._emptyDescriptor); }
/// <devdoc> /// This method returns a custom type descriptor for the given type / object. /// The objectType parameter is always valid, but the instance parameter may /// be null if no instance was passed to TypeDescriptor. The method should /// return a custom type descriptor for the object. If the method is not /// interested in providing type information for the object it should /// return base. /// /// This method is prototyped as virtual, and by default returns a /// custom type descriptor that returns empty collections for all values /// if no parent provider was passed. If a parent provider was passed, /// this method will invoke the parent provider's GetTypeDescriptor /// method. /// </devdoc> public virtual ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { if (_parent != null) { return _parent.GetTypeDescriptor(objectType, instance); } if (_emptyDescriptor == null) { _emptyDescriptor = new EmptyCustomTypeDescriptor(); } return _emptyDescriptor; }
/// <summary> /// This method returns an extended custom type descriptor for the given object. /// An extended type descriptor is a custom type descriptor that offers properties /// that other objects have added to this object, but are not actually defined on /// the object. For example, in the .NET Framework Component Model, objects that /// implement the interface IExtenderProvider can "attach" properties to other /// objects that reside in the same logical container. The GetTypeDescriptor /// method does not return a type descriptor that provides these extra extended /// properties. GetExtendedTypeDescriptor returns the set of these extended /// properties. TypeDescriptor will automatically merge the results of these /// two property collections. Note that while the .NET Framework component /// model only supports extended properties this API can be used for extended /// attributes and events as well, if the type description provider supports it. /// </summary> public virtual ICustomTypeDescriptor GetExtendedTypeDescriptor(object instance) { if (_parent != null) { return _parent.GetExtendedTypeDescriptor(instance); } return _emptyDescriptor ?? (_emptyDescriptor = new EmptyCustomTypeDescriptor()); }