TypeDescriptor.GetConverter Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a type converter for a component or a type.
Overloads
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. |
GetConverter(Type)
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
Returns a type converter for the specified type.
public:
static System::ComponentModel::TypeConverter ^ GetConverter(Type ^ type);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")]
public static System.ComponentModel.TypeConverter GetConverter(Type type);
public static System.ComponentModel.TypeConverter GetConverter(Type type);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")>]
static member GetConverter : Type -> System.ComponentModel.TypeConverter
static member GetConverter : Type -> System.ComponentModel.TypeConverter
Public Shared Function GetConverter (type As Type) As TypeConverter
Parameters
Returns
A TypeConverter for the specified type.
- Attributes
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)
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All. The Type of component cannot be statically discovered.")]
public static System.ComponentModel.TypeConverter GetConverter(object component, bool noCustomTypeDesc);
public static System.ComponentModel.TypeConverter GetConverter(object component, bool noCustomTypeDesc);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All. The Type of component cannot be statically discovered.")>]
static member GetConverter : obj * bool -> System.ComponentModel.TypeConverter
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.
- Attributes
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
- ICustomTypeDescriptor
- TypeConverterAttribute
- GetReflectionType
- GetEditor
- CreateDesigner(IComponent, Type)
Applies to
GetConverter(Object)
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
Returns a type converter for the type of the specified component.
public:
static System::ComponentModel::TypeConverter ^ GetConverter(System::Object ^ component);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All. The Type of component cannot be statically discovered.")]
public static System.ComponentModel.TypeConverter GetConverter(object component);
public static System.ComponentModel.TypeConverter GetConverter(object component);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All. The Type of component cannot be statically discovered.")>]
static member GetConverter : obj -> System.ComponentModel.TypeConverter
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.
- Attributes
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
.