Language
Edit

Span2D Struct

Definition

public readonly ref struct Span2D
type Span2D<'T> = struct
Public Structure Span2D(Of T)

Type Parameters

T
Inheritance
Span2D

Constructors

Name Description
Span2D(T[,,], Int32, Int32, Int32, Int32, Int32)

Initializes a new instance of the Span2D struct wrapping a layer in a 3D array.

Span2D(T[,,], Int32)

Initializes a new instance of the Span2D struct wrapping a layer in a 3D array.

Span2D(T[,], Int32, Int32, Int32, Int32)

Initializes a new instance of the Span2D struct wrapping a 2D array.

Span2D(T[,])

Initializes a new instance of the Span2D struct wrapping a 2D array.

Span2D(T[], Int32, Int32, Int32, Int32)

Initializes a new instance of the Span2D struct.

Span2D(T[], Int32, Int32)

Initializes a new instance of the Span2D struct.

Span2D(Void*, Int32, Int32, Int32)

Initializes a new instance of the Span2D struct with the specified parameters.

Properties

Name Description
Empty

Gets an empty Span2D instance.

Height

Gets the height of the underlying 2D memory area.

IsEmpty

Gets a value indicating whether the current Span2D instance is empty.

Item[Index, Index]

Gets the element at the specified zero-based indices.

Item[Int32, Int32]

Gets the element at the specified zero-based indices.

Item[Range, Range]

Slices the current instance with the specified parameters.

Length

Gets the length of the current Span2D instance.

Width

Gets the width of the underlying 2D memory area.

Methods

Name Description
Clear()

Clears the contents of the current Span2D instance.

CopyTo(Span)

Copies the contents of this Span2D into a destination Span instance.

CopyTo(Span2D)

Copies the contents of this Span2D into a destination Span2D instance. For this API to succeed, the target Span2D has to have the same shape as the current one.

DangerousCreate(T, Int32, Int32, Int32)

Creates a new instance of the Span2D struct with the specified parameters.

DangerousGetReference()

Returns a reference to the first element within the current instance, with no bounds check.

DangerousGetReferenceAt(Int32, Int32)

Returns a reference to a specified element within the current instance, with no bounds check.

Equals(Object)
Obsolete.

Indicates whether this instance and a specified object are equal.

Fill(T)

Fills the elements of this span with a specified value.

GetColumn(Int32)

Gets an enumerable that traverses items in a specified column.

GetEnumerator()

Returns an enumerator for the current Span2D instance.

GetHashCode()
Obsolete.

Returns the hash code for this instance.

GetPinnableReference()

Returns a reference to the 0th element of the Span2D instance. If the current instance is empty, returns a null reference. It can be used for pinning and is required to support the use of span within a fixed statement.

GetRow(Int32)

Gets an enumerable that traverses items in a specified row.

GetRowSpan(Int32)

Gets a Span for a specified row.

Slice(Int32, Int32, Int32, Int32)

Slices the current instance with the specified parameters.

ToArray()

Copies the contents of the current Span2D instance into a new 2D array.

ToString()

Returns the fully qualified type name of this instance.

TryCopyTo(Span)

Attempts to copy the current Span2D instance to a destination Span.

TryCopyTo(Span2D)

Attempts to copy the current Span2D instance to a destination Span2D.

TryGetSpan(Span)

Tries to get a Span instance, if the underlying buffer is contiguous and small enough.

Operators

Name Description
Equality(Span2D, Span2D)

Checks whether two Span2D instances are equal.

Implicit(T[,] to Span2D)
Inequality(Span2D, Span2D)

Checks whether two Span2D instances are not equal.

Applies to