Skip to content

API Host ClrInstanceObject

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

ClrInstanceObject

ScriptObject wrapper around a CLR object instance.

Namespace: AuroraScript.Runtime.Interop. Kind: class.

Back to .NET Host API Reference

Overview

ClrInstanceObject is how a live CLR instance appears inside the script runtime. Member access on the script side is routed to the wrapped object, and a host can recover the original instance through Instance.

Note

Hosts commonly receive this when ClrMarshaller wraps a registered CLR object.

Quick Reference

A minimal use of ClrInstanceObject.

var result = domain.Execute("MAIN", "create");
if (result.Object is ClrInstanceObject wrapper)
{
    Console.WriteLine(wrapper.Instance);
}

Fields

Instance

object Instance

Wrapped CLR object.

Parameters

None.

Returns

Returns object.

Behavior

Cast Instance to the expected host type before use; the wrapper does not validate the target type on the host's behalf.

if (result.Object is ClrInstanceObject wrapper &&
    wrapper.Instance is HostCalculator calculator)
{
    Console.WriteLine(calculator.Total);
}

Clone this wiki locally