Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Span2D<T> Struct
Definition
- Namespace:
- CommunityToolkit.HighPerformance
- Assembly:
- CommunityToolkit.HighPerformance.dll
- Package:
- CommunityToolkit.HighPerformance v8.4.0
- Package:
- CommunityToolkit.HighPerformance v7.0.3
- Source:
- Span2D%7BT%7D.cs
- Source:
- Span2D%7BT%7D.cs
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Span2D<T> represents a 2D region of arbitrary memory. Like the Span<T> type, it can point to either managed or native memory, or to memory allocated on the stack. It is type- and memory-safe. One key difference with Span<T> and arrays is that the underlying buffer for a Span2D<T> instance might not be contiguous in memory: this is supported to enable mapping arbitrary 2D regions even if they require padding between boundaries of sequential rows. All this logic is handled internally by the Span2D<T> type and it is transparent to the user, but note that working over discontiguous buffers has a performance impact.
public readonly ref struct Span2D<T>
type Span2D<'T> = struct
Public Structure Span2D(Of T)
Type Parameters
- T
The type of items in the current Span2D<T> instance.
- Inheritance
-
Span2D<T>
Constructors
| Span2D<T>(T[,,], Int32, Int32, Int32, Int32, Int32) |
Initializes a new instance of the Span2D<T> struct wrapping a layer in a 3D array. |
| Span2D<T>(T[,,], Int32) |
Initializes a new instance of the Span2D<T> struct wrapping a layer in a 3D array. |
| Span2D<T>(T[,], Int32, Int32, Int32, Int32) |
Initializes a new instance of the Span2D<T> struct wrapping a 2D array. |
| Span2D<T>(T[,]) |
Initializes a new instance of the Span2D<T> struct wrapping a 2D array. |
| Span2D<T>(T[], Int32, Int32, Int32, Int32) |
Initializes a new instance of the Span2D<T> struct. |
| Span2D<T>(T[], Int32, Int32) |
Initializes a new instance of the Span2D<T> struct. |
| Span2D<T>(Void*, Int32, Int32, Int32) |
Initializes a new instance of the Span2D<T> struct with the specified parameters. |
Properties
| Empty |
Gets an empty Span2D<T> instance. |
| Height |
Gets the height of the underlying 2D memory area. |
| IsEmpty |
Gets a value indicating whether the current Span2D<T> 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<T> instance. |
| Width |
Gets the width of the underlying 2D memory area. |
Methods
| Clear() |
Clears the contents of the current Span2D<T> instance. |
| CopyTo(Span<T>) |
Copies the contents of this Span2D<T> into a destination Span<T> instance. |
| CopyTo(Span2D<T>) |
Copies the contents of this Span2D<T> into a destination Span2D<T> instance. For this API to succeed, the target Span2D<T> has to have the same shape as the current one. |
| DangerousCreate(T, Int32, Int32, Int32) |
Creates a new instance of the Span2D<T> 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<T> instance. |
| GetHashCode() |
Obsolete.
Returns the hash code for this instance. |
| GetPinnableReference() |
Returns a reference to the 0th element of the Span2D<T> instance. If the current
instance is empty, returns a |
| GetRow(Int32) |
Gets an enumerable that traverses items in a specified row. |
| GetRowSpan(Int32) |
Gets a Span<T> 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<T> instance into a new 2D array. |
| ToString() |
Returns the fully qualified type name of this instance. |
| TryCopyTo(Span<T>) |
Attempts to copy the current Span2D<T> instance to a destination Span<T>. |
| TryCopyTo(Span2D<T>) |
Attempts to copy the current Span2D<T> instance to a destination Span2D<T>. |
| TryGetSpan(Span<T>) |
Tries to get a Span<T> instance, if the underlying buffer is contiguous and small enough. |
Operators
| Equality(Span2D<T>, Span2D<T>) |
Checks whether two Span2D<T> instances are equal. |
| Implicit(T[,] to Span2D<T>) | |
| Inequality(Span2D<T>, Span2D<T>) |
Checks whether two Span2D<T> instances are not equal. |
