ColorConverter.ConvertTo Method

Definition

Converts the specified object to another type.

C#
public override object? ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, Type destinationType);
C#
public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType);

Parameters

context
ITypeDescriptorContext

A formatter context. Use this object to extract additional information about the environment from which this converter is being invoked. Always check whether this value is null. Also, properties on the context object may return null.

culture
CultureInfo

A CultureInfo that specifies the culture to represent the color.

value
Object

The object to convert.

destinationType
Type

The type to convert the object to.

Returns

An Object representing the converted value.

Exceptions

destinationType is null.

The conversion cannot be performed.

Remarks

The most common conversion is to or from a string.

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.1