TimeSpanConverter.CanConvertFrom(ITypeDescriptorContext, Type) Método

Definição

Obtém um valor que indica se esse conversor pode converter um objeto do tipo de origem especificado em um TimeSpan usando o contexto especificado.Gets a value indicating whether this converter can convert an object in the given source type to a TimeSpan 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

Parâmetros

context
ITypeDescriptorContext

Um ITypeDescriptorContext que fornece um contexto de formato.An ITypeDescriptorContext that provides a format context.

sourceType
Type

Um Type que representa o tipo do qual você deseja converter.A Type that represents the type you wish to convert from.

Retornos

Boolean

true se esse conversor puder realizar a conversão; caso contrário, false.true if this converter can perform the conversion; otherwise, false.

Comentários

Esse conversor só pode converter um TimeSpan objeto de e para uma cadeia de caracteres.This converter can only convert a TimeSpan object to and from a string.

O context parâmetro pode ser usado para extrair informações adicionais sobre o ambiente do qual esse conversor está sendo invocado.The context parameter can be used to extract additional information about the environment this converter is being invoked from. Isso pode ser null. Portanto, sempre verifique.This can be null, so always check. Além disso, as propriedades no objeto de contexto podem retornar null.Also, properties on the context object can return null.

Aplica-se a

Confira também