Skip to content

API Host StringBuffer

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

StringBuffer

宿主可直接创建或从脚本接收的运行时字符串构建器对象。

Runtime string builder object that hosts may receive from scripts or create directly.

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

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

返回 .NET Host API 参考

Back to .NET Host API Reference

用途

Purpose

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

Runtime string builder object that hosts may receive from scripts or create directly.

简单示例

Simple Example

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

A minimal use of StringBuffer.

var buffer = new StringBuffer("Aurora");

Console.WriteLine(buffer.Length); // 6
buffer.Release();

成员

Members

Constructor

签名

  • StringBuffer()
  • StringBuffer(string initialValue)

创建 StringBuffer 实例。

Use the member according to its public signature.

Parameters:

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

    The string parameter required by the signature.

Returns

新建的 StringBuffer 实例。

A new StringBuffer instance.

调用示意

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

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

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

int Length

读取 Length 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 int

Returns int.

调用示意

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

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

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

void Release()

调用 Release 完成其公开操作。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

无。

None.

调用示意

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

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

StringBuffer value = /* 从宿主 API 获取实例 */;
value.Release();

string ToString()

调用 ToString 完成其公开操作。

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.

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

Clone this wiki locally