CastArray3DTFrom, TToItem(Int32) Property

Gets a plane of the CastArray3DTFrom, TTo as a CastArray2DTFrom, TTo instance. Please note that the size of TTo multiplied by Width times Height must be divisible by the size of TFrom.

Definition

Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public CastArray2D<TFrom, TTo> this[
	int z
] { get; }

Parameters

z  Int32
The depth index of the plane to obtain.

Return Value

CastArray2DTFrom, TTo
A CastArray2DTFrom, TTo instance that represents a plane of this CastArray3DTFrom, TTo instance.

Remarks

  Note

If the size of TTo multiplied by Width times Height is not divisible by the size of TFrom, then this property throws an ArgumentException. If the targeted platform supports the SpanT type and misaligned memory access, then you can try to use the AsSpan property and the MemoryMarshal.Cast method.

Exceptions

ArgumentOutOfRangeExceptionz is out of range.
ArgumentExceptionThe size of TTo multiplied by Width times Height is not divisible by the size of TFrom.

See Also