MemoryExtensions.AsSpan MemoryExtensions.AsSpan MemoryExtensions.AsSpan MemoryExtensions.AsSpan Method

Definition

Overloads

AsSpan(String, Int32, Int32) AsSpan(String, Int32, Int32) AsSpan(String, Int32, Int32) AsSpan(String, Int32, Int32)

Creates a new read-only span over a string.

AsSpan(String, Int32) AsSpan(String, Int32) AsSpan(String, Int32) AsSpan(String, Int32)

Creates a new read-only span over a portion of the target string from a specified position to the end of the string.

AsSpan(String) AsSpan(String) AsSpan(String) AsSpan(String)

Creates a new read-only span over a portion of the target string from a specified position for a specified number of characters.

AsSpan<T>(ArraySegment<T>) AsSpan<T>(ArraySegment<T>) AsSpan<T>(ArraySegment<T>) AsSpan<T>(ArraySegment<T>)

Creates a new span over a target array segment.

AsSpan<T>(T[]) AsSpan<T>(T[]) AsSpan<T>(T[]) AsSpan<T>(T[])

Creates a new span over a target array.

AsSpan<T>(ArraySegment<T>, Index) AsSpan<T>(ArraySegment<T>, Index) AsSpan<T>(ArraySegment<T>, Index) AsSpan<T>(ArraySegment<T>, Index)

Creates a new span over a portion of the target array segment beginning at a specified index and ending at the end of the segment.

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

Creates a new span over a portion of a target array segment from a specified position to the end of the segment.

AsSpan<T>(ArraySegment<T>, Range) AsSpan<T>(ArraySegment<T>, Range) AsSpan<T>(ArraySegment<T>, Range)

Creates a new span over a portion of a target array segment using the range start and end indexes.

AsSpan<T>(T[], Index) AsSpan<T>(T[], Index) AsSpan<T>(T[], Index) AsSpan<T>(T[], Index)

Creates a new span over the portion of the target array defined by an Index value.

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

Creates a new span over a portion of the target array starting at a specified position to the end of the array.

AsSpan<T>(T[], Range) AsSpan<T>(T[], Range) AsSpan<T>(T[], Range)

Creates a new span over a portion of a target array defined by a Range value.

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

Creates a new span over a portion of a target array segment from a specified position for a specified length.

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

Creates a new span over the portion of the target array beginning at a specified position for a specified length.

AsSpan(String, Int32, Int32) AsSpan(String, Int32, Int32) AsSpan(String, Int32, Int32) AsSpan(String, Int32, Int32)

Creates a new read-only span over a string.

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

Parameters

text
String String String String

The target string.

start
Int32 Int32 Int32 Int32

The index at which to begin this slice.

length
Int32 Int32 Int32 Int32

The desired length for the slice.

Returns

The read-only span representation of the string.

Exceptions

Remarks

Returns default when text is null.

AsSpan(String, Int32) AsSpan(String, Int32) AsSpan(String, Int32) AsSpan(String, Int32)

Creates a new read-only span over a portion of the target string from a specified position to the end of the string.

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

Parameters

text
String String String String

The target string.

start
Int32 Int32 Int32 Int32

The index at which to begin this slice.

Returns

The read-only span representation of the string.

Exceptions

AsSpan(String) AsSpan(String) AsSpan(String) AsSpan(String)

Creates a new read-only span over a portion of the target string from a specified position for a specified number of characters.

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

Parameters

text
String String String String

The target string.

Returns

The read-only span representation of the string.

Remarks

Returns default when text is null.

AsSpan<T>(ArraySegment<T>) AsSpan<T>(ArraySegment<T>) AsSpan<T>(ArraySegment<T>) AsSpan<T>(ArraySegment<T>)

Creates a new span over a target array segment.

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

Type Parameters

T

The type of the array segment.

Parameters

segment
ArraySegment<T> ArraySegment<T> ArraySegment<T> ArraySegment<T>

The array segment to convert.

Returns

The span representation of the array segment.

AsSpan<T>(T[]) AsSpan<T>(T[]) AsSpan<T>(T[]) AsSpan<T>(T[])

Creates a new span over a target array.

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

Type Parameters

T

The type of the array.

Parameters

array
T[]

The array to convert.

Returns

The span representation of the array.

AsSpan<T>(ArraySegment<T>, Index) AsSpan<T>(ArraySegment<T>, Index) AsSpan<T>(ArraySegment<T>, Index) AsSpan<T>(ArraySegment<T>, Index)

Creates a new span over a portion of the target array segment beginning at a specified index and ending at the end of the segment.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(ArraySegment<T> segment, Index startIndex);
public static Span<T> AsSpan<T> (this ArraySegment<T> segment, Index startIndex);
static member AsSpan : ArraySegment<'T> * Index -> Span<'T>
<Extension()>
Public Function AsSpan(Of T) (segment As ArraySegment(Of T), startIndex As Index) As Span(Of T)

Type Parameters

T

The type of the array segment.

Parameters

startIndex
Index Index Index Index

The index at which to begin the Span.

Returns

The span representation of the array segment.

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

Creates a new span over a portion of a target array segment from a specified position to the end of the segment.

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

Type Parameters

T

The type of the array segment.

Parameters

start
Int32 Int32 Int32 Int32

The index at which to begin the san.

Returns

The span representation of the array segment.

Exceptions

Remarks

Returns default when segment is null.

AsSpan<T>(ArraySegment<T>, Range) AsSpan<T>(ArraySegment<T>, Range) AsSpan<T>(ArraySegment<T>, Range)

Creates a new span over a portion of a target array segment using the range start and end indexes.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(ArraySegment<T> segment, Range range);
public static Span<T> AsSpan<T> (this ArraySegment<T> segment, Range range);
static member AsSpan : ArraySegment<'T> * Range -> Span<'T>

Type Parameters

T

The type of the array segment.

Parameters

range
Range Range Range Range

The range which has start and end indexes to use for slicing the array.

Returns

The span representation of the array segment.

AsSpan<T>(T[], Index) AsSpan<T>(T[], Index) AsSpan<T>(T[], Index) AsSpan<T>(T[], Index)

Creates a new span over the portion of the target array defined by an Index value.

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

Type Parameters

T

The array type.

Parameters

array
T[]

The array to convert.

startIndex
Index Index Index Index

The starting index.

Returns

The span representation of the array.

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

Creates a new span over a portion of the target array starting at a specified position to the end of the array.

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

Type Parameters

T

The type of the array.

Parameters

array
T[]

The array to convert.

start
Int32 Int32 Int32 Int32

The initial index from which the array will be converted.

Returns

The span representation of the array.

AsSpan<T>(T[], Range) AsSpan<T>(T[], Range) AsSpan<T>(T[], Range)

Creates a new span over a portion of a target array defined by a Range value.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(cli::array <T> ^ array, Range range);
public static Span<T> AsSpan<T> (this T[] array, Range range);
static member AsSpan : 'T[] * Range -> Span<'T>

Type Parameters

T

The type of the array.

Parameters

array
T[]

The array to convert.

range
Range Range Range Range

The range of the array to convert.

Returns

The span representation of the array.

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

Creates a new span over a portion of a target array segment from a specified position for a specified length.

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

Type Parameters

T

The type of the array segment.

Parameters

start
Int32 Int32 Int32 Int32

The index at which to begin the span.

length
Int32 Int32 Int32 Int32

The number of items in the span.

Returns

The span representation of the array.

Exceptions

Remarks

Returns default when segment is null.

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

Creates a new span over the portion of the target array beginning at a specified position for a specified length.

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

Type Parameters

T

The type of the array.

Parameters

array
T[]

The target array.

start
Int32 Int32 Int32 Int32

The index at which to begin the span.

length
Int32 Int32 Int32 Int32

The number of items in the span.

Returns

The span representation of the array.

Exceptions

Remarks

Returns default when array is null.

Applies to