MemoryMarshal.TryGetString 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
嘗試從 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