WhiteSpaceTrimStringConverter Classe
Definição
Converte uma cadeia de caracteres no formato canônico.Converts a string to its canonical format.
public ref class WhiteSpaceTrimStringConverter sealed : System::Configuration::ConfigurationConverterBase
public sealed class WhiteSpaceTrimStringConverter : System.Configuration.ConfigurationConverterBase
type WhiteSpaceTrimStringConverter = class
inherit ConfigurationConverterBase
Public NotInheritable Class WhiteSpaceTrimStringConverter
Inherits ConfigurationConverterBase
- Herança
Exemplos
O exemplo de código a seguir mostra como aplicar WhiteSpaceTrimStringConverter a uma propriedade de cadeia de caracteres personalizada FileName .The following code example shows how to apply WhiteSpaceTrimStringConverter to a custom string property FileName.
[ConfigurationProperty("fileName", DefaultValue=" default.txt ")]
[TypeConverter(typeof(WhiteSpaceTrimStringConverter))]
public String FileName
{
get
{
return (String)this["fileName"];
}
set
{
this["fileName"] = value;
}
}
<ConfigurationProperty("fileName", _
DefaultValue:=" default.txt "), _
TypeConverter(GetType(WhiteSpaceTrimStringConverter))> _
Public Property FileName() As String
Get
Return CStr(Me("fileName"))
End Get
Set(ByVal value As String)
Me("fileName") = value
End Set
End Property
Este é um trecho de configuração usado pelo exemplo anterior.The following is a configuration excerpt used by the previous example.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="CustomSection"
type="Samples.AspNet.CustomSection,
ConfigurationConverters,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null"
allowDefinition="Everywhere"
allowExeDefinition="MachineToApplication"
restartOnExternalChanges="true" />
</configSections>
<CustomSection fileName="default.txt" maxIdleTime="90" timeDelay="infinite" cdStr="str0, str1" permission="Read" maxUsers="Infinite"/>
</configuration>
Comentários
Esse WhiteSpaceTrimStringConverter objeto converte entre um valor de cadeia de caracteres de configuração e sua representação canônica.This WhiteSpaceTrimStringConverter object converts between a configuration string value and its canonical representation. Representação canônica significa que todos os espaços em branco são cortados do início e do fim de um valor de cadeia de caracteres.Canonical representation means that all white spaces are trimmed from the beginning and end of a string value.
Construtores
| WhiteSpaceTrimStringConverter() |
Inicializa uma nova instância da classe WhiteSpaceTrimStringConverter.Initializes a new instance of the WhiteSpaceTrimStringConverter class. |
Métodos
| CanConvertFrom(ITypeDescriptorContext, Type) |
Determina se a conversão é permitida.Determines whether the conversion is allowed. (Herdado de ConfigurationConverterBase) |
| CanConvertFrom(Type) |
Retorna se este conversor pode converter um objeto do tipo indicado para o tipo deste conversor.Returns whether this converter can convert an object of the given type to the type of this converter. (Herdado de TypeConverter) |
| CanConvertTo(ITypeDescriptorContext, Type) |
Determina se a conversão é permitida.Determines whether the conversion is allowed. (Herdado de ConfigurationConverterBase) |
| CanConvertTo(Type) |
Retorna se esse conversor pode converter o objeto para o tipo especificado.Returns whether this converter can convert the object to the specified type. (Herdado de TypeConverter) |
| ConvertFrom(ITypeDescriptorContext, CultureInfo, Object) |
Converte um String na forma canônica.Converts a String to canonical form. |
| ConvertFrom(Object) |
Converte o valor fornecido noo tipo deste conversor.Converts the given value to the type of this converter. (Herdado de TypeConverter) |
| ConvertFromInvariantString(ITypeDescriptorContext, String) |
Converte a cadeia de caracteres fornecida para o tipo deste conversor usando a cultura invariável e o contexto especificado.Converts the given string to the type of this converter, using the invariant culture and the specified context. (Herdado de TypeConverter) |
| ConvertFromInvariantString(String) |
Converte a cadeia de caracteres fornecida para o tipo deste conversor usando a cultura invariável.Converts the given string to the type of this converter, using the invariant culture. (Herdado de TypeConverter) |
| ConvertFromString(ITypeDescriptorContext, CultureInfo, String) |
Converte o texto fornecido em um objeto, usando o contexto e a informação de cultura especificados.Converts the given text to an object, using the specified context and culture information. (Herdado de TypeConverter) |
| ConvertFromString(ITypeDescriptorContext, String) |
Converte o texto fornecido em um objeto, usando o contexto especificado.Converts the given text to an object, using the specified context. (Herdado de TypeConverter) |
| ConvertFromString(String) |
Converte o texto especificado em um objeto.Converts the specified text to an object. (Herdado de TypeConverter) |
| ConvertTo(ITypeDescriptorContext, CultureInfo, Object, Type) |
Converte um String na forma canônica.Converts a String to canonical form. |
| ConvertTo(Object, Type) |
Converte o objeto de valor especificado para o tipo especificado, usando os argumentos.Converts the given value object to the specified type, using the arguments. (Herdado de TypeConverter) |
| ConvertToInvariantString(ITypeDescriptorContext, Object) |
Converte o valor especificado em uma representação de cadeia de caracteres que não varia de acordo com a cultura, usando o contexto especificado.Converts the specified value to a culture-invariant string representation, using the specified context. (Herdado de TypeConverter) |
| ConvertToInvariantString(Object) |
Converte o valor especificado em uma representação de cadeia de caracteres invariável da cultura.Converts the specified value to a culture-invariant string representation. (Herdado de TypeConverter) |
| ConvertToString(ITypeDescriptorContext, CultureInfo, Object) |
Converte o valor especificado em uma representação de cadeia de caracteres, usando as informações de contexto e cultura especificadas.Converts the given value to a string representation, using the specified context and culture information. (Herdado de TypeConverter) |
| ConvertToString(ITypeDescriptorContext, Object) |
Converte o valor especificado em uma representação de cadeia de caracteres, usando o contexto fornecido.Converts the given value to a string representation, using the given context. (Herdado de TypeConverter) |
| ConvertToString(Object) |
Converte o valor especificado em uma representação de cadeia de caracteres.Converts the specified value to a string representation. (Herdado de TypeConverter) |
| CreateInstance(IDictionary) |
Recria um Object dado um conjunto de valores de propriedade do objeto.Re-creates an Object given a set of property values for the object. (Herdado de TypeConverter) |
| CreateInstance(ITypeDescriptorContext, IDictionary) |
Cria uma instância do tipo ao qual esse TypeConverter está associado, usando o contexto especificado, dado um conjunto de valores de propriedade para o objeto.Creates an instance of the type that this TypeConverter is associated with, using the specified context, given a set of property values for the object. (Herdado de TypeConverter) |
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object. (Herdado de Object) |
| GetConvertFromException(Object) |
Retorna uma exceção a ser gerada quando uma conversão não puder ser executada.Returns an exception to throw when a conversion cannot be performed. (Herdado de TypeConverter) |
| GetConvertToException(Object, Type) |
Retorna uma exceção a ser gerada quando uma conversão não puder ser executada.Returns an exception to throw when a conversion cannot be performed. (Herdado de TypeConverter) |
| GetCreateInstanceSupported() |
Retorna se a alteração de um valor neste objeto requer uma chamada ao método CreateInstance(IDictionary) para criar um novo valor.Returns whether changing a value on this object requires a call to the CreateInstance(IDictionary) method to create a new value. (Herdado de TypeConverter) |
| GetCreateInstanceSupported(ITypeDescriptorContext) |
Retorna se a alteração de um valor neste objeto requer uma chamada para CreateInstance(IDictionary) para criar um novo valor, usando o contexto especificado.Returns whether changing a value on this object requires a call to CreateInstance(IDictionary) to create a new value, using the specified context. (Herdado de TypeConverter) |
| GetHashCode() |
Serve como a função de hash padrão.Serves as the default hash function. (Herdado de Object) |
| GetProperties(ITypeDescriptorContext, Object) |
Retorna uma coleção de propriedades para o tipo de matriz especificado pelo parâmetro de valor, usando o contexto especificado.Returns a collection of properties for the type of array specified by the value parameter, using the specified context. (Herdado de TypeConverter) |
| GetProperties(ITypeDescriptorContext, Object, Attribute[]) |
Retorna uma coleção de propriedades para o tipo de matriz especificado pelo parâmetro de valor, usando o contexto e os atributos especificados.Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes. (Herdado de TypeConverter) |
| GetProperties(Object) |
Retorna uma coleção de propriedades para o tipo de matriz especificado pelo parâmetro de valor.Returns a collection of properties for the type of array specified by the value parameter. (Herdado de TypeConverter) |
| GetPropertiesSupported() |
Retorna se este objeto dá suporte a propriedades.Returns whether this object supports properties. (Herdado de TypeConverter) |
| GetPropertiesSupported(ITypeDescriptorContext) |
Retorna se este objeto é compatível com as propriedades, usando o contexto especificado.Returns whether this object supports properties, using the specified context. (Herdado de TypeConverter) |
| GetStandardValues() |
Retorna uma coleção de valores padrão do contexto padrão para o tipo de dados para o qual esse conversor de tipo foi criado.Returns a collection of standard values from the default context for the data type this type converter is designed for. (Herdado de TypeConverter) |
| GetStandardValues(ITypeDescriptorContext) |
Retorna uma coleção de valores padrão para o tipo de dados para o qual esse conversor de tipo foi criado quando fornecido com um contexto de formato.Returns a collection of standard values for the data type this type converter is designed for when provided with a format context. (Herdado de TypeConverter) |
| GetStandardValuesExclusive() |
Retorna se a coleção de valores padrão retornada de GetStandardValues() é uma lista exclusiva.Returns whether the collection of standard values returned from GetStandardValues() is an exclusive list. (Herdado de TypeConverter) |
| GetStandardValuesExclusive(ITypeDescriptorContext) |
Retorna se a coleção de valores padrão retornada de GetStandardValues() é uma lista exclusiva de possíveis valores, usando o contexto especificado.Returns whether the collection of standard values returned from GetStandardValues() is an exclusive list of possible values, using the specified context. (Herdado de TypeConverter) |
| GetStandardValuesSupported() |
Retorna se este objeto dá suporte a um conjunto padrão de valores que podem ser escolhidos em uma lista.Returns whether this object supports a standard set of values that can be picked from a list. (Herdado de TypeConverter) |
| GetStandardValuesSupported(ITypeDescriptorContext) |
Retorna se o objeto dá suporte a um conjunto de valores padrão que podem ser escolhidos de uma lista, usando o contexto especificado.Returns whether this object supports a standard set of values that can be picked from a list, using the specified context. (Herdado de TypeConverter) |
| GetType() |
Obtém o Type da instância atual.Gets the Type of the current instance. (Herdado de Object) |
| IsValid(ITypeDescriptorContext, Object) |
Retorna se o objeto de valor fornecido é válido para esse tipo e para o contexto especificado.Returns whether the given value object is valid for this type and for the specified context. (Herdado de TypeConverter) |
| IsValid(Object) |
Retorna se o objeto de valor especificado é válido para esse tipo.Returns whether the given value object is valid for this type. (Herdado de TypeConverter) |
| MemberwiseClone() |
Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object. (Herdado de Object) |
| SortProperties(PropertyDescriptorCollection, String[]) |
Classifica uma coleção de propriedades.Sorts a collection of properties. (Herdado de TypeConverter) |
| ToString() |
Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object. (Herdado de Object) |