CastArray3DTFrom, TToSetElementUnaligned Method

Sets the element at the specified indices with assuming misalignment for primitive TTo types. Parameter order is the same as in case of a regular two-dimensional array.

Definition

Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.5.0
C#
public void SetElementUnaligned(
	int z,
	int y,
	int x,
	TTo value
)

Parameters

z  Int32
The Z-coordinate (depth index) of the item to get.
y  Int32
The Y-coordinate (row index) of the item to set.
x  Int32
The X-coordinate (column index) of the item to set.
value  TTo
The value to set.

Remarks

This method assumes misaligned address for primitive TTo items, and also validates the indices against Length. To omit range validation and still writing the elements assuming misalignment, use the GetElementReferenceUnsafe method with a compiler that supports members that return values by reference, and make sure you cast the type of the reference properly before dereferencing it.

Though this member does not validate the coordinates separately, it does not allow indexing beyond the Length of the underlying Buffer.

Exceptions

IndexOutOfRangeExceptionThe specified indices refer to an item outside the bounds of the underlying Buffer.
NotSupportedException.NET Framework only: you access this member in a partially trusted AppDomain that does not allow executing unverifiable code.

See Also