CharConverter.CanConvertFrom(ITypeDescriptorContext, Type) Метод
Определение
Возвращает значение, показывающее, может ли этот преобразователь выполнить преобразование объекта заданного исходного типа в символьный объект Юникод, используя заданный контекст.Gets a value indicating whether this converter can convert an object in the given source type to a Unicode character object using the specified context.
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
Параметры
- context
- ITypeDescriptorContext
Объект ITypeDescriptorContext, предоставляющий контекст формата.An ITypeDescriptorContext that provides a format context.
- sourceType
- Type
Объект Type, представляющий тип, из которого нужно выполнить преобразование.A Type that represents the type you want to convert from.
Возвращаемое значение
Имеет значение true
, если преобразователь может выполнить преобразование, в противном случае — значение false
.true
if this converter can perform the conversion; otherwise, false
.
Комментарии
Этот преобразователь может только преобразовать строку с длиной 1 в символ и из него.This converter can only convert a string, with a length of 1, to and from a character.
Параметр context
служит для получения дополнительных сведений о среде, из которой вызывается данный преобразователь.The context
parameter can be used to extract additional information about the environment this converter is being invoked from. Это может быть значение null
, поэтому следует всегда выполнять проверку.This can be null
, so always check. Свойства объекта контекста могут также возвращать значение null
.Also, properties on the context object can return null
.