This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a Boolean (true orfalse) 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, IConvertiblepublic 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>, IParsable<bool>, ISpanParsable<bool>public readonly struct Boolean : IComparable, IComparable<bool>, IConvertible, IEquatable<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 IConvertibletype 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 IConvertibletype bool = structPublic Structure BooleanImplements IComparable, IComparable(Of Boolean), IConvertible, IEquatable(Of Boolean)Public Structure BooleanImplements IComparable, IComparable(Of Boolean), IConvertible, IEquatable(Of Boolean), IParsable(Of Boolean), ISpanParsable(Of Boolean)Public Structure BooleanImplements IComparable, IConvertiblePublic Structure BooleanImplements IComparable, IComparable(Of Boolean), IEquatable(Of Boolean)For more information about this API, seeSupplemental API remarks for Boolean.
| Name | Description |
|---|---|
| FalseString | Represents the Boolean value |
| TrueString | Represents the Boolean value |
| Name | Description |
|---|---|
| CompareTo(Boolean) | Compares this instance to a specifiedBoolean 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 specifiedBoolean 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 theBoolean value type. |
| Parse(ReadOnlySpan<Char>) | Converts the specified span representation of a logical value to itsBoolean equivalent. |
| Parse(String) | Converts the specified string representation of a logical value to itsBoolean 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 itsBoolean equivalent. |
| TryParse(String, Boolean) | Tries to convert the specified string representation of a logical value to itsBoolean equivalent. |
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.
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Want to try using Ask Learn to clarify or guide you through this topic?