<PackageReference Include="System.ComponentModel.TypeConverter" Version="4.0.1-beta-23409" />

System.ComponentModel.TypeConverter

public class TypeConverter
Provides a unified way of converting types of values to other types, as well as for accessing standard values and subproperties.
public TypeConverter()

Initializes a new instance of the TypeConverter class.

public bool CanConvertFrom(Type sourceType)

Returns whether this converter can convert an object of the given type to the type of this converter.

public virtual bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)

Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context.

public bool CanConvertTo(Type destinationType)

Returns whether this converter can convert the object to the specified type.

public virtual bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)

Returns whether this converter can convert the object to the specified type, using the specified context.

public object ConvertFrom(object value)

Converts the given value to the type of this converter.

public virtual object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)

Converts the given object to the type of this converter, using the specified context and culture information.

public object ConvertFromInvariantString(string text)

Converts the given string to the type of this converter, using the invariant culture.

public object ConvertFromString(string text)

Converts the specified text to an object.

public object ConvertFromString(ITypeDescriptorContext context, CultureInfo culture, string text)

Converts the given text to an object, using the specified context and culture information.

public object ConvertTo(object value, Type destinationType)

Converts the given value object to the specified type, using the arguments.

public virtual object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)

Converts the given value object to the specified type, using the specified context and culture information.

public string ConvertToInvariantString(object value)

Converts the specified value to a culture-invariant string representation.

public string ConvertToString(object value)

Converts the specified value to a string representation.

public string ConvertToString(ITypeDescriptorContext context, CultureInfo culture, object value)

Converts the given value to a string representation, using the specified context and culture information.

protected Exception GetConvertFromException(object value)

Returns an exception to throw when a conversion cannot be performed.

protected Exception GetConvertToException(object value, Type destinationType)

Returns an exception to throw when a conversion cannot be performed.