MemoryMarshal.TryGetString 方法

定義

嘗試從 System.ReadOnlyMemory<Char>中取得底層字串。

public:
 static bool TryGetString(ReadOnlyMemory<char> memory, [Runtime::InteropServices::Out] System::String ^ % text, [Runtime::InteropServices::Out] int % start, [Runtime::InteropServices::Out] int % length);
public static bool TryGetString(ReadOnlyMemory<char> memory, out string? text, out int start, out int length);
public static bool TryGetString(ReadOnlyMemory<char> memory, out string text, out int start, out int length);
static member TryGetString : ReadOnlyMemory<char> * string * int * int -> bool
Public Shared Function TryGetString (memory As ReadOnlyMemory(Of Char), ByRef text As String, ByRef start As Integer, ByRef length As Integer) As Boolean

參數

memory
ReadOnlyMemory<Char>

只讀記憶體,包含一組字元。

text
String

當方法回傳時,記憶體緩衝區中包含的字串。

start
Int32

起始位置。text

length
Int32

text字元數。

傳回

true如果方法成功檢索底層字串;否則,。 false

適用於