TypeDescriptor.GetConverter TypeDescriptor.GetConverter TypeDescriptor.GetConverter TypeDescriptor.GetConverter Method

定义

返回组件或类型的类型转换器。Returns a type converter for a component or a type.

重载

GetConverter(Object) GetConverter(Object) GetConverter(Object) GetConverter(Object)

返回指定组件类型的类型转换器。Returns a type converter for the type of the specified component.

GetConverter(Type) GetConverter(Type) GetConverter(Type)

返回指定类型的类型转换器。Returns a type converter for the specified type.

GetConverter(Object, Boolean) GetConverter(Object, Boolean) GetConverter(Object, Boolean) GetConverter(Object, Boolean)

使用自定义类型说明符返回指定组件类型的类型转换器。Returns a type converter for the type of the specified component with a custom type descriptor.

GetConverter(Object) GetConverter(Object) GetConverter(Object) GetConverter(Object)

返回指定组件类型的类型转换器。Returns a type converter for the type of the specified component.

public:
 static System::ComponentModel::TypeConverter ^ GetConverter(System::Object ^ component);
public static System.ComponentModel.TypeConverter GetConverter (object component);
static member GetConverter : obj -> System.ComponentModel.TypeConverter
Public Shared Function GetConverter (component As Object) As TypeConverter

参数

component
Object Object Object Object

要获取其转换器的组件。A component to get the converter for.

返回

指定组件的 TypeConverterA TypeConverter for the specified component.

异常

component 是一个跨进程远程对象。component is a cross-process remoted object.

示例

有关使用此方法的示例,请参阅TypeConverter类。For an example of using this method, see the TypeConverter class.

注解

此方法通过查找TypeConverterAttribute来查找适当的类型转换器。This method locates an appropriate type converter by looking for a TypeConverterAttribute. 如果找不到TypeConverterAttribute,它将遍历类的基类层次结构,直到它找到基元类型。If it cannot find a TypeConverterAttribute, it traverses the base class hierarchy of the class until it finds a primitive type.

此方法等效于带有的第GetConverter二个参数的false重载方法。This method is equivalent to the overloaded GetConverter method with a second parameter of false.

另请参阅

GetConverter(Type) GetConverter(Type) GetConverter(Type)

返回指定类型的类型转换器。Returns a type converter for the specified type.

public:
 static System::ComponentModel::TypeConverter ^ GetConverter(Type ^ type);
public static System.ComponentModel.TypeConverter GetConverter (Type type);
static member GetConverter : Type -> System.ComponentModel.TypeConverter

参数

type
Type Type Type Type

目标组件的 TypeThe Type of the target component.

返回

异常

注解

仅当没有对象的实例时,才调用此方法的此版本。Call this version of this method only when you do not have an instance of the object.

此方法通过查找TypeConverterAttribute来查找适当的类型转换器。This method looks for the appropriate type converter by looking for a TypeConverterAttribute. 如果找不到TypeConverterAttribute,它将遍历类的基类层次结构,直到它找到基元类型。If it cannot find a TypeConverterAttribute, it traverses the base class hierarchy of the class until it finds a primitive type.

另请参阅

GetConverter(Object, Boolean) GetConverter(Object, Boolean) GetConverter(Object, Boolean) GetConverter(Object, Boolean)

使用自定义类型说明符返回指定组件类型的类型转换器。Returns a type converter for the type of the specified component with a custom type descriptor.

public:
 static System::ComponentModel::TypeConverter ^ GetConverter(System::Object ^ component, bool noCustomTypeDesc);
public static System.ComponentModel.TypeConverter GetConverter (object component, bool noCustomTypeDesc);
static member GetConverter : obj * bool -> System.ComponentModel.TypeConverter
Public Shared Function GetConverter (component As Object, noCustomTypeDesc As Boolean) As TypeConverter

参数

component
Object Object Object Object

要获取其转换器的组件。A component to get the converter for.

noCustomTypeDesc
Boolean Boolean Boolean Boolean

若要考虑自定义类型说明信息,则为true ;否则为 falsetrue to consider custom type description information; otherwise, false.

返回

指定组件的 TypeConverterA TypeConverter for the specified component.

异常

component 是一个跨进程远程对象。component is a cross-process remoted object.

注解

此方法通过尝试查找TypeConverterAttribute来查找适当的类型转换器。This method looks for the appropriate type converter by trying to find a TypeConverterAttribute. 如果找不到TypeConverterAttribute,它将遍历类的基类层次结构,直到它找到基元类型。If it cannot find a TypeConverterAttribute, it traverses the base class hierarchy of the class until it finds a primitive type.

另请参阅

适用于