Skip to content

API Host BooleanValue

Liu.Yandong.Hanks edited this page Aug 21, 2026 · 3 revisions

BooleanValue

Immutable script boolean wrapper.

Namespace: AuroraScript.Runtime.Types. Kind: class.

Back to .NET Host API Reference

Overview

BooleanValue is the runtime object form of a script boolean. Because the type is immutable, the two canonical instances True and False are reused; Of returns one of them rather than allocating.

Tip

When an API already accepts ScriptDatum, prefer ScriptDatum.True, ScriptDatum.False, or ScriptDatum.FromBoolean and avoid the object wrapper entirely.

Quick Reference

A minimal use of BooleanValue.

var enabled = BooleanValue.Of(true);

Console.WriteLine(enabled.Value); // True

Fields

True

static readonly BooleanValue True

Canonical script true instance.

Parameters

None.

Returns

Returns BooleanValue.

var current = BooleanValue.True;

False

static readonly BooleanValue False

Canonical script false instance.

Parameters

None.

Returns

Returns BooleanValue.

var current = BooleanValue.False;

Value

bool Value

Underlying CLR boolean.

Parameters

None.

Returns

Returns bool.

Console.WriteLine(enabled.Value); // True

IntValue

int IntValue

Numeric projection of the boolean.

Parameters

None.

Returns

Returns int.

Console.WriteLine(enabled.IntValue);

StrValue

StringValue StrValue

String projection of the boolean.

Parameters

None.

Returns

Returns StringValue.

Console.WriteLine(enabled.StrValue);

Methods

Of

static BooleanValue Of(bool value)

Returns the canonical instance for a CLR boolean.

Parameters

Name Type Required Description
value bool Yes Value to wrap.

Returns

Returns BooleanValue.

Behavior

Of returns True or False, so results can be compared by reference.

var enabled = BooleanValue.Of(true);

Clone this wiki locally