DekGenius.com
[ Team LiB ] Previous Section Next Section

TypeDescriptor

System.ComponentModel (system.dll)sealed class

This class encapsulates the information about a component. It provides a set of static utility methods to get details of the attributes, properties, and events. You can also get the default property or event.

While this appears to provide exactly the same information as System.Type, it adds an extra level of indirection, allowing you to provide virtual types that would not be represented by the standard type infrastructure.

GetClassName() gets the name of the class, while GetComponentName() gets the name of the component. You can retrieve the TypeConverter for the class with the GetConverter() method, and you can create the designer associated with the type with the CreateDesigner() method.

There are two versions of each method: one takes a Type that can be used if you do not have an actual instance of the type and the other takes an object if you do have a suitable instance.

public sealed class TypeDescriptor {
// Public Static Properties
   public static IComNativeDescriptorHandler ComNativeDescriptorHandler{set; get; }
// Public Static Methods
   public static void AddEditorTable(Type editorBaseType, System.Collections.Hashtable table);
   public static IDesigner CreateDesigner(IComponent component, Type designerBaseType);
   public static EventDescriptor CreateEvent(Type componentType, EventDescriptor oldEventDescriptor, 
        params Attribute[] attributes);
   public static EventDescriptor CreateEvent(Type componentType, string name, Type type, params Attribute[] attributes);
   public static PropertyDescriptor CreateProperty(Type componentType, PropertyDescriptor oldPropertyDescriptor,
        params Attribute[] attributes);
   public static PropertyDescriptor CreateProperty(Type componentType, string name, Type type, 
        params Attribute[] attributes);
   public static AttributeCollection GetAttributes(object component);
   public static AttributeCollection GetAttributes(object component, bool noCustomTypeDesc);
   public static AttributeCollection GetAttributes(Type componentType);
   public static string GetClassName(object component);
   public static string GetClassName(object component, bool noCustomTypeDesc);
   public static string GetComponentName(object component);
   public static string GetComponentName(object component, bool noCustomTypeDesc);
   public static TypeConverter GetConverter(object component);
   public static TypeConverter GetConverter(object component, bool noCustomTypeDesc);
   public static TypeConverter GetConverter(Type type);
   public static EventDescriptor GetDefaultEvent(object component);
   public static EventDescriptor GetDefaultEvent(object component, bool noCustomTypeDesc);
   public static EventDescriptor GetDefaultEvent(Type componentType);
   public static PropertyDescriptor GetDefaultProperty(object component);
   public static PropertyDescriptor GetDefaultProperty(object component, bool noCustomTypeDesc);
   public static PropertyDescriptor GetDefaultProperty(Type componentType);
   public static object GetEditor(object component, Type editorBaseType);
   public static object GetEditor(object component, Type editorBaseType, bool noCustomTypeDesc);
   public static object GetEditor(Type type, Type editorBaseType);
   public static EventDescriptorCollection GetEvents(object component);
   public static EventDescriptorCollection GetEvents(object component, Attribute[] attributes);
   public static EventDescriptorCollection GetEvents(object component, Attribute[] attributes, bool noCustomTypeDesc);
   public static EventDescriptorCollection GetEvents(object component, bool noCustomTypeDesc);
   public static EventDescriptorCollection GetEvents(Type componentType);
   public static EventDescriptorCollection GetEvents(Type componentType, Attribute[] attributes);
   public static PropertyDescriptorCollection GetProperties(object component);
   public static PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes);
   public static PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes, 
        bool noCustomTypeDesc);
   public static PropertyDescriptorCollection GetProperties(object component, bool noCustomTypeDesc);
   public static PropertyDescriptorCollection GetProperties(Type componentType);
   public static PropertyDescriptorCollection GetProperties(Type componentType, Attribute[] attributes);
   public static void Refresh(System.Reflection.Assembly assembly);
   public static void Refresh(System.Reflection.Module module);
   public static void Refresh(object component);
   public static void Refresh(Type type);
   public static void SortDescriptorArray(System.Collections.IList infos);
// Events
   public event RefreshEventHandler Refreshed;
}
    [ Team LiB ] Previous Section Next Section