-
Notifications
You must be signed in to change notification settings - Fork 0
API Host BooleanValue
Immutable script boolean wrapper.
Namespace: AuroraScript.Runtime.Types. Kind: class.
Back to .NET Host API Reference
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.
A minimal use of BooleanValue.
var enabled = BooleanValue.Of(true);
Console.WriteLine(enabled.Value); // Truestatic readonly BooleanValue TrueCanonical script true instance.
Parameters
None.
Returns
Returns BooleanValue.
var current = BooleanValue.True;static readonly BooleanValue FalseCanonical script false instance.
Parameters
None.
Returns
Returns BooleanValue.
var current = BooleanValue.False;bool ValueUnderlying CLR boolean.
Parameters
None.
Returns
Returns bool.
Console.WriteLine(enabled.Value); // Trueint IntValueNumeric projection of the boolean.
Parameters
None.
Returns
Returns int.
Console.WriteLine(enabled.IntValue);StringValue StrValueString projection of the boolean.
Parameters
None.
Returns
Returns StringValue.
Console.WriteLine(enabled.StrValue);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);AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License