Table of Contents

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

Value short

The VARIANT_BOOL value.

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

ComBool

True

Gets VARIANT_TRUE (-1).

public static ComBool True { get; }

Property Value

ComBool

Value

The VARIANT_BOOL value.

public short Value { get; init; }

Property Value

short

Methods

Equals(ComBool)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ComBool other)

Parameters

other ComBool

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

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

bool

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

left ComBool
right ComBool

Returns

ComBool

operator |(ComBool, ComBool)

Computes the logical OR of the values.

public static ComBool operator |(ComBool left, ComBool right)

Parameters

left ComBool
right ComBool

Returns

ComBool

operator ^(ComBool, ComBool)

Computes the logical exclusive OR of the values.

public static ComBool operator ^(ComBool left, ComBool right)

Parameters

left ComBool
right ComBool

Returns

ComBool

operator false(ComBool)

Returns whether the value is false; together with & and | enables && and ||.

public static bool operator false(ComBool value)

Parameters

value ComBool

Returns

bool

implicit operator bool(ComBool)

Converts a ComBool to a bool.

public static implicit operator bool(ComBool value)

Parameters

value ComBool

Returns

bool

implicit operator ComBool(bool)

Converts a bool to VARIANT_TRUE or VARIANT_FALSE.

public static implicit operator ComBool(bool value)

Parameters

value bool

Returns

ComBool

operator !(ComBool)

Computes the logical negation of the value.

public static ComBool operator !(ComBool value)

Parameters

value ComBool

Returns

ComBool

operator true(ComBool)

Returns whether the value is true; together with & and | enables && and ||.

public static bool operator true(ComBool value)

Parameters

value ComBool

Returns

bool