MemoryExtensions.AsMemory 方法

定義

多載

AsMemory(String)

在目標字串部分上建立新 ReadOnlyMemory<Char>

AsMemory(String, Index)

在起始於指定索引的目標字串部分上建立新 ReadOnlyMemory<Char>

AsMemory(String, Int32)

在起始於指定字元位置的目標字串部分上建立新 ReadOnlyMemory<Char>

AsMemory(String, Range)

在指定的目標字串範圍上建立新 ReadOnlyMemory<Char>

AsMemory(String, Int32, Int32)

在起始於指定位置且具有一個長度的目標字串部分上建立新 ReadOnlyMemory<Char>

AsMemory<T>(ArraySegment<T>)

在目標陣列區段部分上建立新記憶體區域。

AsMemory<T>(T[])

在目標陣列上建立新記憶體區域。

AsMemory<T>(ArraySegment<T>, Int32)

在起始於指定位置到區段結尾的目標陣列區段部分上建立新記憶體區域。

AsMemory<T>(T[], Index)

在起始於指定索引到陣列結尾的目標陣列部分上建立新記憶體區域。

AsMemory<T>(T[], Int32)

在起始於指定位置到陣列結尾的目標陣列部分上建立新記憶體區域。

AsMemory<T>(T[], Range)

在起始於範圍開始索引 (含) 且結束於範圍結束索引 (不含) 的目標陣列部分上建立新記憶體區域。

AsMemory<T>(ArraySegment<T>, Int32, Int32)

在起始於指定位置且具有指定長度的目標陣列區段部分上建立新記憶體區域。

AsMemory<T>(T[], Int32, Int32)

在起始於指定位置且具有指定長度的目標陣列部分上建立新記憶體區域。

AsMemory(String)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在目標字串部分上建立新 ReadOnlyMemory<Char>

public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlyMemory<char> AsMemory(System::String ^ text);
public static ReadOnlyMemory<char> AsMemory (this string? text);
public static ReadOnlyMemory<char> AsMemory (this string text);
static member AsMemory : string -> ReadOnlyMemory<char>
<Extension()>
Public Function AsMemory (text As String) As ReadOnlyMemory(Of Char)

參數

text
String

目標字串。

傳回

字串的唯讀字元記憶體表示;如果 textnull,則為 default

備註

當 為 nulltext,會傳回預設值。

適用於

AsMemory(String, Index)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在起始於指定索引的目標字串部分上建立新 ReadOnlyMemory<Char>

public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlyMemory<char> AsMemory(System::String ^ text, Index startIndex);
public static ReadOnlyMemory<char> AsMemory (this string? text, Index startIndex);
public static ReadOnlyMemory<char> AsMemory (this string text, Index startIndex);
static member AsMemory : string * Index -> ReadOnlyMemory<char>
<Extension()>
Public Function AsMemory (text As String, startIndex As Index) As ReadOnlyMemory(Of Char)

參數

text
String

目標字串。

startIndex
Index

要開始此配量的索引。

傳回

字串的唯讀字元記憶體表示。

適用於

AsMemory(String, Int32)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在起始於指定字元位置的目標字串部分上建立新 ReadOnlyMemory<Char>

public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlyMemory<char> AsMemory(System::String ^ text, int start);
public static ReadOnlyMemory<char> AsMemory (this string? text, int start);
public static ReadOnlyMemory<char> AsMemory (this string text, int start);
static member AsMemory : string * int -> ReadOnlyMemory<char>
<Extension()>
Public Function AsMemory (text As String, start As Integer) As ReadOnlyMemory(Of Char)

參數

text
String

目標字串。

start
Int32

要開始此配量的索引。

傳回

字串的唯讀字元記憶體表示;如果 textnull,則為 default

例外狀況

start不在 (start< 的範圍text是0或 >text.Length) 。

備註

當 為 nulltext,會傳回預設值。

適用於

AsMemory(String, Range)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在指定的目標字串範圍上建立新 ReadOnlyMemory<Char>

public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlyMemory<char> AsMemory(System::String ^ text, Range range);
public static ReadOnlyMemory<char> AsMemory (this string? text, Range range);
public static ReadOnlyMemory<char> AsMemory (this string text, Range range);
static member AsMemory : string * Range -> ReadOnlyMemory<char>
<Extension()>
Public Function AsMemory (text As String, range As Range) As ReadOnlyMemory(Of Char)

參數

text
String

目標字串。

range
Range

表示已切割字串開頭和長度的範圍。

傳回

字串的唯讀字元記憶體表示。

適用於

AsMemory(String, Int32, Int32)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在起始於指定位置且具有一個長度的目標字串部分上建立新 ReadOnlyMemory<Char>

public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlyMemory<char> AsMemory(System::String ^ text, int start, int length);
public static ReadOnlyMemory<char> AsMemory (this string? text, int start, int length);
public static ReadOnlyMemory<char> AsMemory (this string text, int start, int length);
static member AsMemory : string * int * int -> ReadOnlyMemory<char>
<Extension()>
Public Function AsMemory (text As String, start As Integer, length As Integer) As ReadOnlyMemory(Of Char)

參數

text
String

目標字串。

start
Int32

要開始此配量的索引。

length
Int32

配量所需的長度。

傳回

字串的唯讀字元記憶體表示;如果 textnull,則為 default

例外狀況

startlengthstart + length 不在 text 的範圍內。

備註

當 為 nulltext,會傳回預設值。

適用於

AsMemory<T>(ArraySegment<T>)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在目標陣列區段部分上建立新記憶體區域。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Memory<T> AsMemory(ArraySegment<T> segment);
public static Memory<T> AsMemory<T> (this ArraySegment<T> segment);
static member AsMemory : ArraySegment<'T> -> Memory<'T>
<Extension()>
Public Function AsMemory(Of T) (segment As ArraySegment(Of T)) As Memory(Of T)

類型參數

T

區段的類型。

參數

segment
ArraySegment<T>

要轉換的區段。

傳回

區段的記憶體表示。

適用於

AsMemory<T>(T[])

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在目標陣列上建立新記憶體區域。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Memory<T> AsMemory(cli::array <T> ^ array);
public static Memory<T> AsMemory<T> (this T[]? array);
public static Memory<T> AsMemory<T> (this T[] array);
static member AsMemory : 'T[] -> Memory<'T>
<Extension()>
Public Function AsMemory(Of T) (array As T()) As Memory(Of T)

類型參數

T

陣列的類型。

參數

array
T[]

要轉換的陣列。

傳回

完整或部分陣列的記憶體表示。

適用於

AsMemory<T>(ArraySegment<T>, Int32)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在起始於指定位置到區段結尾的目標陣列區段部分上建立新記憶體區域。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Memory<T> AsMemory(ArraySegment<T> segment, int start);
public static Memory<T> AsMemory<T> (this ArraySegment<T> segment, int start);
static member AsMemory : ArraySegment<'T> * int -> Memory<'T>
<Extension()>
Public Function AsMemory(Of T) (segment As ArraySegment(Of T), start As Integer) As Memory(Of T)

類型參數

T

陣列的類型。

參數

segment
ArraySegment<T>

目標陣列區段。

start
Int32

要開始記憶體的索引。

傳回

完整或部分陣列的記憶體表示。

例外狀況

segment 是 Covariant,且 segment 的型別不完全是 T[]

start 小於 0 或大於 segment.Count

備註

當為nullsegmentdefault回 。

適用於

AsMemory<T>(T[], Index)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在起始於指定索引到陣列結尾的目標陣列部分上建立新記憶體區域。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Memory<T> AsMemory(cli::array <T> ^ array, Index startIndex);
public static Memory<T> AsMemory<T> (this T[]? array, Index startIndex);
public static Memory<T> AsMemory<T> (this T[] array, Index startIndex);
static member AsMemory : 'T[] * Index -> Memory<'T>
<Extension()>
Public Function AsMemory(Of T) (array As T(), startIndex As Index) As Memory(Of T)

類型參數

T

陣列的類型。

參數

array
T[]

要轉換的陣列。

startIndex
Index

陣列的第一個位置。

傳回

完整或部分陣列的記憶體表示。

適用於

AsMemory<T>(T[], Int32)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在起始於指定位置到陣列結尾的目標陣列部分上建立新記憶體區域。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Memory<T> AsMemory(cli::array <T> ^ array, int start);
public static Memory<T> AsMemory<T> (this T[]? array, int start);
public static Memory<T> AsMemory<T> (this T[] array, int start);
static member AsMemory : 'T[] * int -> Memory<'T>
<Extension()>
Public Function AsMemory(Of T) (array As T(), start As Integer) As Memory(Of T)

類型參數

T

陣列的類型。

參數

array
T[]

目標陣列。

start
Int32

要開始記憶體的索引。

傳回

完整或部分陣列的記憶體表示。

例外狀況

array 是 Covariant,且陣列的類型不完全是 T[]

start 索引小於 0 或大於 array.Length

備註

當為nullarraydefault回 。

適用於

AsMemory<T>(T[], Range)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在起始於範圍開始索引 (含) 且結束於範圍結束索引 (不含) 的目標陣列部分上建立新記憶體區域。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Memory<T> AsMemory(cli::array <T> ^ array, Range range);
public static Memory<T> AsMemory<T> (this T[]? array, Range range);
public static Memory<T> AsMemory<T> (this T[] array, Range range);
static member AsMemory : 'T[] * Range -> Memory<'T>
<Extension()>
Public Function AsMemory(Of T) (array As T(), range As Range) As Memory(Of T)

類型參數

T

陣列的類型。

參數

array
T[]

要轉換的陣列。

range
Range

要從陣列轉換的範圍。

傳回

完整或部分陣列的記憶體表示。

適用於

AsMemory<T>(ArraySegment<T>, Int32, Int32)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在起始於指定位置且具有指定長度的目標陣列區段部分上建立新記憶體區域。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Memory<T> AsMemory(ArraySegment<T> segment, int start, int length);
public static Memory<T> AsMemory<T> (this ArraySegment<T> segment, int start, int length);
static member AsMemory : ArraySegment<'T> * int * int -> Memory<'T>
<Extension()>
Public Function AsMemory(Of T) (segment As ArraySegment(Of T), start As Integer, length As Integer) As Memory(Of T)

類型參數

T

陣列的類型。

參數

segment
ArraySegment<T>

目標陣列區段。

start
Int32

要開始記憶體的索引。

length
Int32

記憶體中的項目數。

傳回

完整或部分陣列的記憶體表示。

例外狀況

segment 是 Covariant,且陣列的類型不完全是 T[]

startlengthstart + length 不在 segment 的範圍內。

備註

當為nullsegmentdefault回 。

適用於

AsMemory<T>(T[], Int32, Int32)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

在起始於指定位置且具有指定長度的目標陣列部分上建立新記憶體區域。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Memory<T> AsMemory(cli::array <T> ^ array, int start, int length);
public static Memory<T> AsMemory<T> (this T[]? array, int start, int length);
public static Memory<T> AsMemory<T> (this T[] array, int start, int length);
static member AsMemory : 'T[] * int * int -> Memory<'T>
<Extension()>
Public Function AsMemory(Of T) (array As T(), start As Integer, length As Integer) As Memory(Of T)

類型參數

T

陣列的類型。

參數

array
T[]

目標陣列。

start
Int32

要開始記憶體區域的索引。

length
Int32

記憶體區域中的項目數。

傳回

完整或部分陣列的記憶體表示。

例外狀況

array 是 Covariant,且陣列的類型不完全是 T[]

startlengthstart + length 不在 array 的範圍內。

備註

當為nullarraydefault回 。

適用於