String.Create<TState> メソッド

定義

指定したコールバックを使用して、特定の長さの新しい文字列を作成し、作成後に初期化します。

public:
generic <typename TState>
 static System::String ^ Create(int length, TState state, System::Buffers::SpanAction<char, TState> ^ action);
public static string Create<TState>(int length, TState state, System.Buffers.SpanAction<char,TState> action);
static member Create : int * 'State * System.Buffers.SpanAction<char, 'State> -> string
Public Shared Function Create(Of TState) (length As Integer, state As TState, action As SpanAction(Of Char, TState)) As String

型パラメーター

TState

actionに渡す要素の型。

パラメーター

length
Int32

作成する文字列の長さ。

state
TState

actionに渡す要素。

action
SpanAction<Char,TState>

文字列を初期化するためのコールバック。

返品

作成された文字列。

注釈

actionに渡される宛先スパンの初期コンテンツは未定義です。 そのため、スパンのすべての要素が確実に割り当てられるのは代理人の責任です。 それ以外の場合、結果の文字列にランダムな文字が含まれる可能性があります。

相互運用シナリオをサポートするために、基になるバッファーは、アクション コールバックの span パラメーターによって表される 1 つ以上であることが保証されます。 この追加のインデックスは null ターミネータを表し、書き込まれた場合はサポートされる唯一の値です。 null ターミネータ以外の値を書き込むと、文字列が破損し、未定義の動作と見なされます。

適用対象