DateTimeConverter.CanConvertFrom(ITypeDescriptorContext, Type) Метод
Определение
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 wish to convert from.
Возвращаемое значение
true
, если этот объект может выполнить преобразование; в противном случае — false
.true
if this object can perform the conversion; otherwise, false
.
Комментарии
Этот преобразователь может только преобразовать DateTime в строку и из нее.This converter can only convert a DateTime to and from a string.
Параметр 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
.