BooleanConverter Класс
Определение
public ref class BooleanConverter : System::ComponentModel::TypeConverter
public class BooleanConverter : System.ComponentModel.TypeConverter
type BooleanConverter = class
inherit TypeConverter
Public Class BooleanConverter
Inherits TypeConverter
- Наследование
Примеры
В следующем примере кода переменная типа преобразуется Boolean в строку и из нее.The following code example converts a variable of type Boolean to and from a string.
bool bVal(true);
String^ strA = "false";
Console::WriteLine( TypeDescriptor::GetConverter( bVal )->ConvertTo( bVal, String::typeid ) );
Console::WriteLine( TypeDescriptor::GetConverter( bVal )->ConvertFrom( strA ) );
bool bVal=true;
string strA="false";
Console.WriteLine(TypeDescriptor.GetConverter(bVal).ConvertTo(bVal, typeof(string)));
Console.WriteLine(TypeDescriptor.GetConverter(bVal).ConvertFrom(strA));
Dim bVal As Boolean = True
Dim strA As String = "false"
Console.WriteLine(TypeDescriptor.GetConverter(bVal).ConvertTo(bVal, GetType(String)))
Console.WriteLine(TypeDescriptor.GetConverter(bVal).ConvertFrom(strA))
Комментарии
Этот преобразователь может только преобразовать Boolean объект в строку и обратно.This converter can only convert a Boolean object to and from a string.
Дополнительные сведения о преобразователях типов см. в разделе TypeConverter базовый класс и инструкции: реализация преобразователя типов.For more information about type converters, see the TypeConverter base class and How to: Implement a Type Converter.
Примечание
Никогда не следует создавать экземпляр BooleanConverter .You should never create an instance of a BooleanConverter. Вместо этого необходимо вызвать метод GetConverter класса TypeDescriptor.Instead, call the GetConverter method of the TypeDescriptor class. Дополнительные сведения см. в примерах в TypeConverter базовом классе.For more information, see the examples in the TypeConverter base class.
Конструкторы
BooleanConverter() |
Инициализирует новый экземпляр класса BooleanConverter.Initializes a new instance of the BooleanConverter class. |
Методы
CanConvertFrom(ITypeDescriptorContext, Type) |
Возвращает значение, показывающее, может ли этот преобразователь выполнить преобразование объекта заданного исходного типа в объект типа Boolean, используя заданный контекст.Gets a value indicating whether this converter can convert an object in the given source type to a Boolean object using the specified context. |
CanConvertFrom(Type) |
Возвращает значение, указывающее, может ли этот преобразователь преобразовать объект заданного типа к типу этого преобразователя.Returns whether this converter can convert an object of the given type to the type of this converter. (Унаследовано от TypeConverter) |
CanConvertTo(ITypeDescriptorContext, Type) |
Возвращает значение, показывающее, может ли этот преобразователь преобразовать объект в заданный тип с помощью указанного контекста.Returns whether this converter can convert the object to the specified type, using the specified context. (Унаследовано от TypeConverter) |
CanConvertTo(Type) |
Возвращает значение, указывающее, может ли этот преобразователь выполнить преобразование данного объекта к заданному типу.Returns whether this converter can convert the object to the specified type. (Унаследовано от TypeConverter) |
ConvertFrom(ITypeDescriptorContext, CultureInfo, Object) |
Преобразует данный объект значения в объект Boolean.Converts the given value object to a Boolean object. |
ConvertFrom(Object) |
Приводит заданное значение к типу этого преобразователя.Converts the given value to the type of this converter. (Унаследовано от TypeConverter) |
ConvertFromInvariantString(ITypeDescriptorContext, String) |
Преобразует заданную строку к типу этого преобразователя, используя нейтральные язык и региональные параметры вместе с заданным контекстом.Converts the given string to the type of this converter, using the invariant culture and the specified context. (Унаследовано от TypeConverter) |
ConvertFromInvariantString(String) |
Преобразует заданную строку к типу этого преобразователя, используя нейтральные язык и региональные параметры.Converts the given string to the type of this converter, using the invariant culture. (Унаследовано от TypeConverter) |
ConvertFromString(ITypeDescriptorContext, CultureInfo, String) |
Преобразует заданный текст в объект, используя заданный контекст и сведения о языке и региональных параметрах.Converts the given text to an object, using the specified context and culture information. (Унаследовано от TypeConverter) |
ConvertFromString(ITypeDescriptorContext, String) |
Преобразует заданный текст в объект, используя заданный контекст.Converts the given text to an object, using the specified context. (Унаследовано от TypeConverter) |
ConvertFromString(String) |
Преобразует заданный текст в объект.Converts the specified text to an object. (Унаследовано от TypeConverter) |
ConvertTo(ITypeDescriptorContext, CultureInfo, Object, Type) |
Преобразует заданный объект значения в указанный тип с использованием указанного контекста и сведений о культуре.Converts the given value object to the specified type, using the specified context and culture information. (Унаследовано от TypeConverter) |
ConvertTo(Object, Type) |
Преобразует данное значение в указанный тип, используя заданные аргументы.Converts the given value object to the specified type, using the arguments. (Унаследовано от TypeConverter) |
ConvertToInvariantString(ITypeDescriptorContext, Object) |
Преобразует указанное значение в строковое представление для нейтральных языка и региональных параметров.Converts the specified value to a culture-invariant string representation, using the specified context. (Унаследовано от TypeConverter) |
ConvertToInvariantString(Object) |
Преобразует указанное значение в строковое представление для нейтральных языка и региональных параметров.Converts the specified value to a culture-invariant string representation. (Унаследовано от TypeConverter) |
ConvertToString(ITypeDescriptorContext, CultureInfo, Object) |
Преобразует данное значение в заданный тип, используя заданный контекст и сведения о языке и региональных параметрах.Converts the given value to a string representation, using the specified context and culture information. (Унаследовано от TypeConverter) |
ConvertToString(ITypeDescriptorContext, Object) |
Преобразует данное значение в строку, используя данный контекст.Converts the given value to a string representation, using the given context. (Унаследовано от TypeConverter) |
ConvertToString(Object) |
Преобразует указанное значение в строковое представление.Converts the specified value to a string representation. (Унаследовано от TypeConverter) |
CreateInstance(IDictionary) |
Повторно создает объект Object, задающий набор значений свойств для объекта.Re-creates an Object given a set of property values for the object. (Унаследовано от TypeConverter) |
CreateInstance(ITypeDescriptorContext, IDictionary) |
Создает экземпляр типа, с которым связан этот TypeConverter, используя заданный контекст с учетом набора значений свойств для объекта.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. (Унаследовано от TypeConverter) |
Equals(Object) |
Определяет, равен ли указанный объект текущему объекту.Determines whether the specified object is equal to the current object. (Унаследовано от Object) |
GetConvertFromException(Object) |
Возвращает исключение, возникающее в случае, если невозможно выполнить преобразование.Returns an exception to throw when a conversion cannot be performed. (Унаследовано от TypeConverter) |
GetConvertToException(Object, Type) |
Возвращает исключение, возникающее в случае, если невозможно выполнить преобразование.Returns an exception to throw when a conversion cannot be performed. (Унаследовано от TypeConverter) |
GetCreateInstanceSupported() |
Возвращает значение, показывающее, требуется ли при изменении значения этого объекта вызывать метод CreateInstance(IDictionary), чтобы создать новое значение.Returns whether changing a value on this object requires a call to the CreateInstance(IDictionary) method to create a new value. (Унаследовано от TypeConverter) |
GetCreateInstanceSupported(ITypeDescriptorContext) |
Возвращает значение, указывающее, требуется ли для изменения значения в этом объекте вызов CreateInstance(IDictionary), чтобы создать новое значение с помощью указанного контекста.Returns whether changing a value on this object requires a call to CreateInstance(IDictionary) to create a new value, using the specified context. (Унаследовано от TypeConverter) |
GetHashCode() |
Служит хэш-функцией по умолчанию.Serves as the default hash function. (Унаследовано от Object) |
GetProperties(ITypeDescriptorContext, Object) |
Возвращает коллекцию свойств для типа массива, заданного параметром, используя заданный контекст.Returns a collection of properties for the type of array specified by the value parameter, using the specified context. (Унаследовано от TypeConverter) |
GetProperties(ITypeDescriptorContext, Object, Attribute[]) |
Возвращает коллекцию свойств для типа массива, заданного параметром value, используя заданные контекст и атрибуты.Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes. (Унаследовано от TypeConverter) |
GetProperties(Object) |
Возвращает коллекцию свойств для типа массива, заданного параметром значения.Returns a collection of properties for the type of array specified by the value parameter. (Унаследовано от TypeConverter) |
GetPropertiesSupported() |
Возвращает значение, показывающее, поддерживаются ли свойства этим объектом.Returns whether this object supports properties. (Унаследовано от TypeConverter) |
GetPropertiesSupported(ITypeDescriptorContext) |
Возвращает значение, показывающее, поддерживает ли данный объект свойства, используя заданный контекст.Returns whether this object supports properties, using the specified context. (Унаследовано от TypeConverter) |
GetStandardValues() |
Возвращает коллекцию стандартных значений из контекста по умолчанию для типа данных, для которого предназначен этот преобразователь типов.Returns a collection of standard values from the default context for the data type this type converter is designed for. (Унаследовано от TypeConverter) |
GetStandardValues(ITypeDescriptorContext) |
Возвращает коллекцию стандартных значений для типа данных Boolean.Gets a collection of standard values for the Boolean data type. |
GetStandardValuesExclusive() |
Возвращает значение, показывающее, является ли исчерпывающим списком коллекция стандартных значений, возвращаемая методом GetStandardValues().Returns whether the collection of standard values returned from GetStandardValues() is an exclusive list. (Унаследовано от TypeConverter) |
GetStandardValuesExclusive(ITypeDescriptorContext) |
Возвращает значение, показывающее, является ли список стандартных значений, возвращенных методом GetStandardValues(ITypeDescriptorContext), исчерпывающим.Gets a value indicating whether the list of standard values returned from the GetStandardValues(ITypeDescriptorContext) method is an exclusive list. |
GetStandardValuesSupported() |
Возвращает значение, показывающее, поддерживает ли объект стандартный набор значений, которые можно выбрать из списка.Returns whether this object supports a standard set of values that can be picked from a list. (Унаследовано от TypeConverter) |
GetStandardValuesSupported(ITypeDescriptorContext) |
Получает значение, показывающее, поддерживает ли этот объект стандартный набор значений, которые можно выбрать из списка.Gets a value indicating whether this object supports a standard set of values that can be picked from a list. |
GetType() |
Возвращает объект Type для текущего экземпляра.Gets the Type of the current instance. (Унаследовано от Object) |
IsValid(ITypeDescriptorContext, Object) |
Возвращает значение, показывающее, допустим ли для этого типа и указанного контекста данный объект значения.Returns whether the given value object is valid for this type and for the specified context. (Унаследовано от TypeConverter) |
IsValid(Object) |
Возвращает значение, показывающее, допустим ли для этого типа данный объект значения.Returns whether the given value object is valid for this type. (Унаследовано от TypeConverter) |
MemberwiseClone() |
Создает неполную копию текущего объекта Object.Creates a shallow copy of the current Object. (Унаследовано от Object) |
SortProperties(PropertyDescriptorCollection, String[]) |
Сортирует коллекцию свойств.Sorts a collection of properties. (Унаследовано от TypeConverter) |
ToString() |
Возвращает строку, представляющую текущий объект.Returns a string that represents the current object. (Унаследовано от Object) |