편집

다음을 통해 공유


DataMemberConverter.CanConvertFrom(ITypeDescriptorContext, Type) Method

Definition

Gets a value indicating whether the converter can convert an object of the specified source type to the native type of the converter.

public:
 override bool CanConvertFrom(System::ComponentModel::ITypeDescriptorContext ^ context, Type ^ sourceType);
public override bool CanConvertFrom (System.ComponentModel.ITypeDescriptorContext context, Type sourceType);
override this.CanConvertFrom : System.ComponentModel.ITypeDescriptorContext * Type -> bool
Public Overrides Function CanConvertFrom (context As ITypeDescriptorContext, sourceType As Type) As Boolean

Parameters

context
ITypeDescriptorContext

An ITypeDescriptorContext object that can be used to gain additional context information.

sourceType
Type

A Type that represents the type you wish to convert from.

Returns

true if the converter can perform the conversion; otherwise, false.

Notes to Inheritors

Override this method to meet your own conversion requirements.

The context parameter can be used to extract additional information about the environment the converter is being invoked from. It might be null, so you should always check. Also, properties of the context object might also return null.

Applies to

See also