Memory2D<T> Struct
Definition
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.
Memory2D<T> represents a 2D region of arbitrary memory. It is to Span2D<T> what Memory<T> is to Span<T>. For further details on how the internal layout is structured, see the docs for Span2D<T>. The Memory2D<T> type can wrap arrays of any rank, provided that a valid series of parameters for the target memory area(s) are specified.
public readonly struct Memory2D<T> : IEquatable<CommunityToolkit.HighPerformance.Memory2D<T>>
type Memory2D<'T> = struct
Public Structure Memory2D(Of T)
Implements IEquatable(Of Memory2D(Of T))
Type Parameters
- T
The type of items in the current Memory2D<T> instance.
- Inheritance
-
Memory2D<T>
- Implements
-
IEquatable<Memory2D<T>>
Constructors
Memory2D<T>(T[,,], Int32, Int32, Int32, Int32, Int32) |
Initializes a new instance of the Memory2D<T> struct wrapping a layer in a 3D array. |
Memory2D<T>(T[,,], Int32) |
Initializes a new instance of the Memory2D<T> struct wrapping a layer in a 3D array. |
Memory2D<T>(T[,], Int32, Int32, Int32, Int32) |
Initializes a new instance of the Memory2D<T> struct wrapping a 2D array. |
Memory2D<T>(T[,]) |
Initializes a new instance of the Memory2D<T> struct wrapping a 2D array. |
Memory2D<T>(T[], Int32, Int32, Int32, Int32) |
Initializes a new instance of the Memory2D<T> struct. |
Memory2D<T>(T[], Int32, Int32) |
Initializes a new instance of the Memory2D<T> struct. |
Properties
Empty |
Gets an empty Memory2D<T> instance. |
Height |
Gets the height of the underlying 2D memory area. |
IsEmpty |
Gets a value indicating whether the current Memory2D<T> instance is empty. |
Length |
Gets the length of the current Memory2D<T> instance. |
Span |
Gets a Span2D<T> instance from the current memory. |
Width |
Gets the width of the underlying 2D memory area. |
Methods
CopyTo(Memory<T>) |
Copies the contents of this Memory2D<T> into a destination Memory<T> instance. |
CopyTo(Memory2D<T>) |
Copies the contents of this Memory2D<T> into a destination Memory2D<T> instance. For this API to succeed, the target Memory2D<T> has to have the same shape as the current one. |
DangerousCreate(Object, T, Int32, Int32, Int32) |
Creates a new Memory2D<T> instance from an arbitrary object. |
Equals(Memory2D<T>) | |
Equals(Object) |
Indicates whether this instance and a specified object are equal. |
GetHashCode() |
Returns the hash code for this instance. |
Pin() |
Creates a handle for the memory. The GC will not move the memory until the returned MemoryHandle is disposed, enabling taking and using the memory's address. |
Slice(Int32, Int32, Int32, Int32) |
Slices the current instance with the specified parameters. |
ToArray() |
Copies the contents of the current Memory2D<T> instance into a new 2D array. |
ToString() |
Returns the fully qualified type name of this instance. |
TryCopyTo(Memory<T>) |
Attempts to copy the current Memory2D<T> instance to a destination Memory<T>. |
TryCopyTo(Memory2D<T>) |
Attempts to copy the current Memory2D<T> instance to a destination Memory2D<T>. For this API to succeed, the target Memory2D<T> has to have the same shape as the current one. |
TryGetMemory(Memory<T>) |
Tries to get a Memory<T> instance, if the underlying buffer is contiguous and small enough. |
Operators
Implicit(T[,] to Memory2D<T>) |