Edit

Bagikan melalui


LinkConverter.ConvertTo Method

Definition

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

Parameters

context
ITypeDescriptorContext

An ITypeDescriptorContext providing contextual information about the object to be converted.

culture
CultureInfo

Cultural attributes of the object to be converted. If this parameter is null, the CurrentCulture property value is used.

value
Object

The object to be converted.

destinationType
Type

The type to convert the object to.

Returns

The converted object.

Exceptions

The object cannot be converted to the destination type.

The destinationType is null.

Remarks

The most common conversion is from one String to another String. The default implementation calls ToString on the object if the object is valid and if the destinationType is String.

Applies to

See also