Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

struct System.​Boolean

Assembly: System.Runtime

Represents a Boolean ( <see langword="true" /> or <see langword="false" /> ) value.

Fields and Constants

public static readonly string
FalseString
Represents the Boolean value <see langword="false" /> as a string. This field is read-only.
public static readonly string
TrueString
Represents the Boolean value <see langword="true" /> as a string. This field is read-only.

Methods

public int
CompareTo​(bool value)
value A <see cref="T:System.Boolean" /> object to compare to this instance.
Returns A signed integer that indicates the relative values of this instance and <paramref name="value" /> . <list type="table"> <listheader> <term> Return Value</term> <description> Condition</description> </listheader> <item> <term> Less than zero</term> <description> This instance is <see langword="false" /> and <paramref name="value" /> is <see langword="true" />.</description> </item> <item> <term> Zero</term> <description> This instance and <paramref name="value" /> are equal (either both are <see langword="true" /> or both are <see langword="false" />).</description> </item> <item> <term> Greater than zero</term> <description> This instance is <see langword="true" /> and <paramref name="value" /> is <see langword="false" />.</description> </item> </list>
Compares this instance to a specified <see cref="T:System.Boolean" /> object and returns an integer that indicates their relationship to one another.
public int
CompareTo​(object obj)
obj An object to compare to this instance, or <see langword="null" /> .
Returns A signed integer that indicates the relative order of this instance and <paramref name="obj" /> . <list type="table"> <listheader> <term> Return Value</term> <description> Condition</description> </listheader> <item> <term> Less than zero</term> <description> This instance is <see langword="false" /> and <paramref name="obj" /> is <see langword="true" />.</description> </item> <item> <term> Zero</term> <description> This instance and <paramref name="obj" /> are equal (either both are <see langword="true" /> or both are <see langword="false" />).</description> </item> <item> <term> Greater than zero</term> <description> This instance is <see langword="true" /> and <paramref name="obj" /> is <see langword="false" />. -or- <paramref name="obj" /> is <see langword="null" />.</description> </item> </list>
Compares this instance to a specified object and returns an integer that indicates their relationship to one another.
public bool
Equals​(bool obj)
obj A <see cref="T:System.Boolean" /> value to compare to this instance.
Returns <see langword="true" /> if <paramref name="obj" /> has the same value as this instance; otherwise, <see langword="false" /> .
Returns a value indicating whether this instance is equal to a specified <see cref="T:System.Boolean" /> object.
public bool
Equals​(object obj)
obj An object to compare to this instance.
Returns <see langword="true" /> if <paramref name="obj" /> is a <see cref="T:System.Boolean" /> and has the same value as this instance; otherwise, <see langword="false" /> .
Returns a value indicating whether this instance is equal to a specified object.
public int
GetHashCode​()
Returns A hash code for the current <see cref="T:System.Boolean" /> .
Returns the hash code for this instance.
public TypeCode
GetTypeCode​()
Returns The enumerated constant <see cref="F:System.TypeCode.Boolean" /> .
Returns the type code for the <see cref="T:System.Boolean" /> value type.
public string
ToString​()
Returns "True" (the value of the <see cref="F:System.Boolean.TrueString" /> property) if the value of this instance is <see langword="true" /> , or "False" (the value of the <see cref="F:System.Boolean.FalseString" /> property) if the value of this instance is <see langword="false" /> .
Converts the value of this instance to its equivalent string representation (either "True" or "False").
public string
ToString​(IFormatProvider provider)
provider (Reserved) An <see cref="T:System.IFormatProvider" /> object.
Returns <see cref="F:System.Boolean.TrueString" /> if the value of this instance is <see langword="true" /> , or <see cref="F:System.Boolean.FalseString" /> if the value of this instance is <see langword="false" /> .
Converts the value of this instance to its equivalent string representation (either "True" or "False").
public bool
TryFormat​(Span`1 destination, Int32& charsWritten)
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .