TypeDescriptor.GetConverter Method

Definition

Returns a type converter for a component or a type.

Overloads

GetConverter(Object)

Returns a type converter for the type of the specified component.

GetConverter(Type)

Returns a type converter for the specified type.

GetConverter(Object, Boolean)

Returns a type converter for the type of the specified component with a custom type descriptor.

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

Parameters

component
Object

A component to get the converter for.

Returns

A TypeConverter for the specified component.

Exceptions

component is null.

component is a cross-process remoted object.

Examples

For an example of using this method, see the TypeConverter class.

Remarks

This method locates an appropriate type converter by looking for a TypeConverterAttribute. If it cannot find a TypeConverterAttribute, it traverses the base class hierarchy of the class until it finds a primitive type.

This method is equivalent to the overloaded GetConverter method with a second parameter of false.

See also

Applies to

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
Public Shared Function GetConverter (type As Type) As TypeConverter

Parameters

type
Type

The Type of the target component.

Returns

A TypeConverter for the specified type.

Exceptions

type is null.

Remarks

Call this version of this method only when you do not have an instance of the object.

This method looks for the appropriate type converter by looking for a TypeConverterAttribute. If it cannot find a TypeConverterAttribute, it traverses the base class hierarchy of the class until it finds a primitive type.

See also

Applies to

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

Parameters

component
Object

A component to get the converter for.

noCustomTypeDesc
Boolean

true to not consider custom type description information; otherwise, false.

Returns

A TypeConverter for the specified component.

Exceptions

component is null.

component is a cross-process remoted object.

Remarks

This method looks for the appropriate type converter by trying to find a TypeConverterAttribute. If it cannot find a TypeConverterAttribute, it traverses the base class hierarchy of the class until it finds a primitive type.

See also

Applies to