s&box docs

public sealed struct Sandbox.Variant

A Variant is a type that can hold any value, and also keeps track of the type of the value it holds. It's useful for cases where you want to store a value of an unknown type, or when you want to serialize/deserialize values of various types in a generic way.

Broader workflow and conceptual references connected to this API.

Constructors

Showing 1 constructors

public Variant(object o, System.Type t = null)

Parameters

  • t: Default: null

Methods

Showing 3 methods

public T Get()

public static override object JsonRead(System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert)

public static override void JsonWrite(object value, System.Text.Json.Utf8JsonWriter writer)

Properties

Showing 2 properties

public System.Type Sandbox.Variant.Type { get; set; }

The type of the value currently stored in the Variant. This is automatically set when you assign a value to the Variant.

public object Sandbox.Variant.Value { get; set; }

Gets or sets the value associated with this instance.

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.Variant

On this page