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

定义

使用指定上下文和参数将给定值对象转换为指定目标类型。Converts the given value object to the specified destination type using the specified context and arguments.

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);
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

一个 ITypeDescriptorContext,用于提供格式上下文。An ITypeDescriptorContext that provides a format context.

culture
CultureInfo

CultureInfo,它指明要转换到的语言。A CultureInfo that provides the language to convert to.

value
Object

要转换的 ObjectThe Object to convert.

destinationType
Type

要将该值转换到的 TypeThe Type to which to convert the value.

返回

Object

一个 Object,它表示转换后的值。An Object that represents the converted value.

例外

destinationTypenulldestinationType is null.

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

注解

context参数可用于提取有关从中调用此转换器的环境的其他信息。The context parameter can be used to extract additional information about the environment from which this converter is being invoked. 此参数可能为 null,因此总是需要检查。This can be null, so always check. 同样,上下文对象的属性可以返回 nullAlso, properties on the context object can return null.

适用于

另请参阅