Skip to content

API Host ScriptSource

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

ScriptSource and References

Back to .NET Host API Reference

Overview

ScriptSource represents source text and path identity; MemorySource is a string-backed implementation; ScriptSourceReference is the stable identity produced by resolution. Resolvers usually create these types, while application code usually uses ScriptSources.

Properties

BaseDirectory

Resolver root used for module-relative paths and source read routing.

string BaseDirectory

Returns

Resolver root, module-relative path, full or virtual path, and source text.

ScriptSource source = new MemorySource("mem://app/", "mem://app/main.as", "@module(MAIN);");
Console.WriteLine(source.FullPath);
Console.WriteLine(source.Code);

SourcePath

Module-relative path used by the compiler and runtime.

string SourcePath

Parameters

None.

Returns

Returns string.

FullPath

Absolute file path or virtual source identifier.

string FullPath

Parameters

None.

Returns

Returns string.

Code

string Code

Parameters

None.

Returns

Returns string.

Methods

ReadSource

string ReadSource()

Parameters

None.

Returns

Source text.

var source = new MemorySource("mem://app/", "mem://app/main.as", "@module(MAIN);");
var text = source.ReadSource();

Clone this wiki locally