MemorySlice<T> Constructor

Definition

Namespace: Numerics.NET.Collections
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4

Overload List

MemorySlice<T>(T[]) Constructs a new array stride with zero offset and unit stride.
MemorySlice<T>(Int32, Boolean) Constructs a new array slice.
MemorySlice<T>(Memory<T>, Int32) Constructs a new array.
MemorySlice<T>(T[], Int32) Constructs a new array.

MemorySlice<T>(T[])

Constructs a new array stride with zero offset and unit stride.
C#
public MemorySlice(
	T[] values
)

Parameters

values  T[]
The storage array.

MemorySlice<T>(Int32, Boolean)

Constructs a new array slice.
C#
public MemorySlice(
	int length,
	bool initializeToZero = true
)

Parameters

length  Int32
The capacity of the slice.
initializeToZero  Boolean  (Optional)
Optional.Indicates whether the elements should be explicitly set to zero. The default is true.

Remarks

Use this constructor to create an array slice that wraps a standard .NET array of the specified length. The offset is zero and the stride is 1.

MemorySlice<T>(Memory<T>, Int32)

Constructs a new array.
C#
public MemorySlice(
	Memory<T> values,
	int stride = 1
)

Parameters

values  Memory<T>
The storage array.
stride  Int32  (Optional)
The step between elements in the storage array.

Remarks

The values array is re-used. Modifying elements in the array slice will modify the elements in the original array. Conversely, if elements in the original array that correspond to elements in the array slice are modified, the elements of the array slice are modified as well.

MemorySlice<T>(T[], Int32)

Constructs a new array.
C#
public MemorySlice(
	T[] values,
	int stride = 1
)

Parameters

values  T[]
The storage array.
stride  Int32  (Optional)
The step between elements in the storage array.

Remarks

The values array is re-used. Modifying elements in the array slice will modify the elements in the original array. Conversely, if elements in the original array that correspond to elements in the array slice are modified, the elements of the array slice are modified as well.

See Also