System.ComponentModel.TypeDescriptionProvider.GetExtendedTypeDescriptor C# (CSharp) Method

GetExtendedTypeDescriptor() public method

public GetExtendedTypeDescriptor ( object instance ) : ICustomTypeDescriptor
instance object
return ICustomTypeDescriptor
        public virtual ICustomTypeDescriptor GetExtendedTypeDescriptor(object instance)
        {
            if (_parent != null)
            {
                return _parent.GetExtendedTypeDescriptor(instance);
            }

            if (_emptyDescriptor == null) {
                _emptyDescriptor = new EmptyCustomTypeDescriptor();
            }

            return _emptyDescriptor;
        }

Usage Example

 /// <summary>Gets an extended custom type descriptor for the given object.</summary>
 /// <returns>An <see cref="T:System.ComponentModel.ICustomTypeDescriptor" /> that can provide extended metadata for the object.</returns>
 /// <param name="instance">The object for which to get the extended type descriptor.</param>
 public virtual ICustomTypeDescriptor GetExtendedTypeDescriptor(object instance)
 {
     if (_parent != null)
     {
         return(_parent.GetExtendedTypeDescriptor(instance));
     }
     if (_emptyCustomTypeDescriptor == null)
     {
         _emptyCustomTypeDescriptor = new EmptyCustomTypeDescriptor();
     }
     return(_emptyCustomTypeDescriptor);
 }