Επεξεργασία

Κοινή χρήση μέσω


Boolean Struct

Definition

Represents a Boolean (true or false) value.

public value class bool : IComparable, IComparable<bool>, IConvertible, IEquatable<bool>
public value class bool : IComparable, IComparable<bool>, IConvertible, IEquatable<bool>, IParsable<bool>, ISpanParsable<bool>
public value class bool : IComparable, IConvertible
public value class bool : IComparable, IComparable<bool>, IEquatable<bool>
public struct Boolean : IComparable, IComparable<bool>, IConvertible, IEquatable<bool>
public readonly struct Boolean : IComparable, IComparable<bool>, IConvertible, IEquatable<bool>
public readonly struct Boolean : IComparable, IComparable<bool>, IConvertible, IEquatable<bool>, IParsable<bool>, ISpanParsable<bool>
[System.Serializable]
public struct Boolean : IComparable, IConvertible
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct Boolean : IComparable, IComparable<bool>, IConvertible, IEquatable<bool>
public struct Boolean : IComparable, IComparable<bool>, IEquatable<bool>
type bool = struct
    interface IConvertible
type bool = struct
    interface IConvertible
    interface IParsable<bool>
    interface ISpanParsable<bool>
[<System.Serializable>]
type bool = struct
    interface IConvertible
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type bool = struct
    interface IConvertible
type bool = struct
Public Structure Boolean
Implements IComparable, IComparable(Of Boolean), IConvertible, IEquatable(Of Boolean)
Public Structure Boolean
Implements IComparable, IComparable(Of Boolean), IConvertible, IEquatable(Of Boolean), IParsable(Of Boolean), ISpanParsable(Of Boolean)
Public Structure Boolean
Implements IComparable, IConvertible
Public Structure Boolean
Implements IComparable, IComparable(Of Boolean), IEquatable(Of Boolean)
Inheritance
Boolean
Attributes
Implements

Remarks

For more information about this API, see Supplemental API remarks for Boolean.

Fields

FalseString

Represents the Boolean value false as a string. This field is read-only.

TrueString

Represents the Boolean value true as a string. This field is read-only.

Methods

CompareTo(Boolean)

Compares this instance to a specified Boolean object and returns an integer that indicates their relationship to one another.

CompareTo(Object)

Compares this instance to a specified object and returns an integer that indicates their relationship to one another.

Equals(Boolean)

Returns a value indicating whether this instance is equal to a specified Boolean object.

Equals(Object)

Returns a value indicating whether this instance is equal to a specified object.

GetHashCode()

Returns the hash code for this instance.

GetTypeCode()

Returns the type code for the Boolean value type.

Parse(ReadOnlySpan<Char>)

Converts the specified span representation of a logical value to its Boolean equivalent.

Parse(String)

Converts the specified string representation of a logical value to its Boolean equivalent.

ToString()

Converts the value of this instance to its equivalent string representation (either "True" or "False").

ToString(IFormatProvider)

Converts the value of this instance to its equivalent string representation (either "True" or "False").

TryFormat(Span<Char>, Int32)

Tries to format the value of the current boolean instance into the provided span of characters.

TryParse(ReadOnlySpan<Char>, Boolean)

Tries to convert the specified span representation of a logical value to its Boolean equivalent.

TryParse(String, Boolean)

Tries to convert the specified string representation of a logical value to its Boolean equivalent.

Explicit Interface Implementations

IComparable.CompareTo(Object)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

IConvertible.GetTypeCode()

Returns the TypeCode for this instance.

IConvertible.ToBoolean(IFormatProvider)

For a description of this member, see ToBoolean(IFormatProvider).

IConvertible.ToByte(IFormatProvider)

For a description of this member, see ToByte(IFormatProvider).

IConvertible.ToChar(IFormatProvider)

This conversion is not supported. Attempting to use this method throws an InvalidCastException.

IConvertible.ToDateTime(IFormatProvider)

This conversion is not supported. Attempting to use this method throws an InvalidCastException.

IConvertible.ToDecimal(IFormatProvider)

For a description of this member, see ToDecimal(IFormatProvider).

IConvertible.ToDouble(IFormatProvider)

For a description of this member, see ToDouble(IFormatProvider).

IConvertible.ToInt16(IFormatProvider)

For a description of this member, see ToInt16(IFormatProvider).

IConvertible.ToInt32(IFormatProvider)

For a description of this member, see ToInt32(IFormatProvider).

IConvertible.ToInt64(IFormatProvider)

For a description of this member, see ToInt64(IFormatProvider).

IConvertible.ToSByte(IFormatProvider)

For a description of this member, see ToSByte(IFormatProvider).

IConvertible.ToSingle(IFormatProvider)

For a description of this member, see ToSingle(IFormatProvider).

IConvertible.ToString(IFormatProvider)

Converts the value of this instance to an equivalent string using the specified culture-specific formatting information.

IConvertible.ToType(Type, IFormatProvider)

For a description of this member, see ToType(Type, IFormatProvider).

IConvertible.ToUInt16(IFormatProvider)

For a description of this member, see ToUInt16(IFormatProvider).

IConvertible.ToUInt32(IFormatProvider)

For a description of this member, see ToUInt32(IFormatProvider).

IConvertible.ToUInt64(IFormatProvider)

For a description of this member, see ToUInt64(IFormatProvider).

IParsable<Boolean>.Parse(String, IFormatProvider)

Parses a string into a value.

IParsable<Boolean>.TryParse(String, IFormatProvider, Boolean)
ISpanParsable<Boolean>.Parse(ReadOnlySpan<Char>, IFormatProvider)

Parses a span of characters into a value.

ISpanParsable<Boolean>.TryParse(ReadOnlySpan<Char>, IFormatProvider, Boolean)

Applies to

Thread Safety

All members of this type are thread safe. Members that appear to modify instance state actually return a new instance initialized with the new value. As with any other type, reading and writing to a shared variable that contains an instance of this type must be protected by a lock to guarantee thread safety.