ColorConverter.ConvertTo(ITypeDescriptorContext, CultureInfo, Object, Type) 方法

定义

将指定的对象转换为其他类型。Converts the specified object to another type.

public:
 override System::Object ^ ConvertTo(System::ComponentModel::ITypeDescriptorContext ^ context, System::Globalization::CultureInfo ^ culture, System::Object ^ value, Type ^ destinationType);
public override object ConvertTo (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType);
override this.ConvertTo : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * obj * Type -> obj
Public Overrides Function ConvertTo (context As ITypeDescriptorContext, culture As CultureInfo, value As Object, destinationType As Type) As Object

参数

context
ITypeDescriptorContext

格式化程序上下文。A formatter context. 使用此对象提取有关从中调用此转换器的环境的附加信息。Use this object to extract additional information about the environment from which this converter is being invoked. 始终检查此值是否为 nullAlways check whether this value is null. 同样,上下文对象上的属性也可能返回 nullAlso, properties on the context object may return null.

culture
CultureInfo

一个 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.

返回

Object

表示已转换的值的 ObjectAn Object representing the converted value.

例外

destinationtypenulldestinationtype is null.

无法执行转换。The conversion cannot be performed.

注解

最常见的转换是与字符串之间的转换。The most common conversion is to or from a string.

适用于