Struct ComBool
- Namespace
- CsCom.Runtime
- Assembly
- CsCom.Runtime.dll
An OLE Automation Boolean value (VARIANT_BOOL). It has the layout of VARIANT_BOOL, so it can be used in
blittable structures, and converts implicitly to and from bool.
public readonly record struct ComBool : IEquatable<ComBool>
- Implements
- Inherited Members
Remarks
VARIANT_TRUE is -1 and VARIANT_FALSE is 0. Like in OLE Automation, any non-zero value is true,
so two values are equal when they are both true or both false. The Boolean operators !, &,
| and ^ work on the truth values and return VARIANT_TRUE or VARIANT_FALSE;
&& and || short-circuit, returning the left operand as is when it decides the result.
Constructors
ComBool(short)
An OLE Automation Boolean value (VARIANT_BOOL). It has the layout of VARIANT_BOOL, so it can be used in
blittable structures, and converts implicitly to and from bool.
public ComBool(short Value)
Parameters
ValueshortThe
VARIANT_BOOLvalue.
Remarks
VARIANT_TRUE is -1 and VARIANT_FALSE is 0. Like in OLE Automation, any non-zero value is true,
so two values are equal when they are both true or both false. The Boolean operators !, &,
| and ^ work on the truth values and return VARIANT_TRUE or VARIANT_FALSE;
&& and || short-circuit, returning the left operand as is when it decides the result.
Properties
False
Gets VARIANT_FALSE (0).
public static ComBool False { get; }
Property Value
True
Gets VARIANT_TRUE (-1).
public static ComBool True { get; }
Property Value
Value
The VARIANT_BOOL value.
public short Value { get; init; }
Property Value
Methods
Equals(ComBool)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ComBool other)
Parameters
otherComBoolAn object to compare with this object.
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToBoolean()
Converts the value to a bool.
public bool ToBoolean()
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator &(ComBool, ComBool)
Computes the logical AND of the values.
public static ComBool operator &(ComBool left, ComBool right)
Parameters
Returns
operator |(ComBool, ComBool)
Computes the logical OR of the values.
public static ComBool operator |(ComBool left, ComBool right)
Parameters
Returns
operator ^(ComBool, ComBool)
Computes the logical exclusive OR of the values.
public static ComBool operator ^(ComBool left, ComBool right)
Parameters
Returns
operator false(ComBool)
Returns whether the value is false; together with & and | enables && and ||.
public static bool operator false(ComBool value)
Parameters
valueComBool
Returns
implicit operator bool(ComBool)
public static implicit operator bool(ComBool value)
Parameters
valueComBool
Returns
implicit operator ComBool(bool)
Converts a bool to VARIANT_TRUE or VARIANT_FALSE.
public static implicit operator ComBool(bool value)
Parameters
valuebool
Returns
operator !(ComBool)
Computes the logical negation of the value.
public static ComBool operator !(ComBool value)
Parameters
valueComBool
Returns
operator true(ComBool)
Returns whether the value is true; together with & and | enables && and ||.
public static bool operator true(ComBool value)
Parameters
valueComBool