CastArrayTFrom, TToSetElementUnaligned Method

Sets the element at the specified index with assuming misalignment for primitive TTo types.

Definition

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

Parameters

index  Int32
The index of the element to set.
value  TTo
The value to set.

Remarks

This method assumes misaligned address for primitive TTo items, and also validates index 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.

Exceptions

IndexOutOfRangeExceptionindex is less than zero or greater or equal to Length.
NotSupportedException.NET Framework only: you access this member in a partially trusted AppDomain that does not allow executing unverifiable code.

See Also