ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> Constructors

Definition

Overloads

ReadOnlySpan<T>(T[]) ReadOnlySpan<T>(T[]) ReadOnlySpan<T>(T[]) ReadOnlySpan<T>(T[])

Creates a new ReadOnlySpan<T> over the entirety of a specified array.

ReadOnlySpan<T>(Void*, Int32) ReadOnlySpan<T>(Void*, Int32) ReadOnlySpan<T>(Void*, Int32)

Creates a new ReadOnlySpan<T> from a specified number of T elements starting at a specified memory address.

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

Creates a new ReadOnlySpan<T> that includes a specified number of elements of an array starting at a specified index.

ReadOnlySpan<T>(T[]) ReadOnlySpan<T>(T[]) ReadOnlySpan<T>(T[]) ReadOnlySpan<T>(T[])

Creates a new ReadOnlySpan<T> over the entirety of a specified array.

public:
 ReadOnlySpan(cli::array <T> ^ array);
public ReadOnlySpan (T[] array);
new ReadOnlySpan<'T> : 'T[] -> ReadOnlySpan<'T>
Public Sub New (array As T())

Parameters

array
T[]

The array from which to create the ReadOnlySpan<T>.

Remarks

If the array is null, this constructor returns a null ReadOnlySpan<T>.

ReadOnlySpan<T>(Void*, Int32) ReadOnlySpan<T>(Void*, Int32) ReadOnlySpan<T>(Void*, Int32)

Important

This API is not CLS-compliant.

Creates a new ReadOnlySpan<T> from a specified number of T elements starting at a specified memory address.

public:
 ReadOnlySpan(void* pointer, int length);
[System.CLSCompliant(false)]
public ReadOnlySpan (void* pointer, int length);
new ReadOnlySpan<'T> : nativeptr<unit> * int -> ReadOnlySpan<'T>

Parameters

pointer
Void*

A pointer to the starting address of a specified number of T elements in memory.

length
Int32 Int32 Int32 Int32

The number of T elements to be included in the ReadOnlySpan<T>.

Exceptions

T is a reference type or contains references and therefore cannot be stored in unmanaged memory.

Remarks

This constructor should be used with care, since it creates arbitrarily typed Ts from a block of memory.

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

Creates a new ReadOnlySpan<T> that includes a specified number of elements of an array starting at a specified index.

public:
 ReadOnlySpan(cli::array <T> ^ array, int start, int length);
public ReadOnlySpan (T[] array, int start, int length);
new ReadOnlySpan<'T> : 'T[] * int * int -> ReadOnlySpan<'T>
Public Sub New (array As T(), start As Integer, length As Integer)

Parameters

array
T[]

The array from which to create the ReadOnlySpan<T>.

start
Int32 Int32 Int32 Int32

The index of the first element to include.

length
Int32 Int32 Int32 Int32

The number of elements to include.

Exceptions

array is null, but start or length is non-zero.

-or-

start is outside the bounds of the array.

-or-

start and length exceeds the number of elements in the array.

Remarks

#

This method returns default when array is null.

Applies to