Skip to content

API Host StringValue

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

StringValue

不可变的脚本字符串包装类型。

Immutable script string wrapper.

命名空间:AuroraScript.Runtime.Types。类型:class。

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

返回 .NET Host API 参考

Back to .NET Host API Reference

用途

Purpose

StringValue 是公开宿主类型。通过下方签名选择调用方式;对运行时对象、生命周期和异常,应由宿主在边界处明确处理。

Immutable script string wrapper.

简单示例

Simple Example

下面是 StringValue 的最小使用方式。

A minimal use of StringValue.

var text = StringValue.Of("Aurora");

Console.WriteLine(text.Value); // Aurora

成员

Members

Constructor

签名

  • StringValue(string str)
  • StringValue(char str)

创建 StringValue 实例。

Use the member according to its public signature.

Parameters:

  • str
    按签名提供的 string 参数。

    The string parameter required by the signature.

Returns

新建的 StringValue 实例。

A new StringValue instance.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

var value = new StringValue(/* 参数 */);

string Value

读取 Value 字段。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 string

Returns string.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

StringValue value = /* 从宿主 API 获取实例 */;
var current = value.Value;

static StringValue Of(string value)

调用 Of 完成其公开操作。

Use the member according to its public signature.

Parameters:

  • value
    要处理、保存或转换的值。

    Value to process, store, or convert.

Returns

返回 StringValue

Returns StringValue.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

var result = StringValue.Of(/* value */);

static StringValue Intern(string value)

调用 Intern 完成其公开操作。

Use the member according to its public signature.

Parameters:

  • value
    要处理、保存或转换的值。

    Value to process, store, or convert.

Returns

返回 StringValue

Returns StringValue.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

var result = StringValue.Intern(/* value */);

bool IsTrue()

调用 IsTrue 完成其公开操作。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 bool

Returns bool.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

StringValue value = /* 从宿主 API 获取实例 */;
var result = value.IsTrue();

Clone this wiki locally