CastArray2DTFrom, TToSetElementUnsafe Method

Sets the element at the specified indices without any range check or validation. This method can even throw a NullReferenceException if the IsNull property returns . To validate the coordinates against Length use the appropriate indexer instead. 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.0.0
C#
[SecurityCriticalAttribute]
public void SetElementUnsafe(
	int y,
	int x,
	TTo value
)

Parameters

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

  Caution

You must ensure that the specified indices designate an element in the bounds of the actual underlying array. Attempting to access protected memory may crash the runtime.

If the compiler you use supports members that return a value by reference, you can also use the GetElementReferenceUnsafe method.

Exceptions

NotSupportedException.NET Framework only: you execute this method in a partially trusted AppDomain that does not allow executing unverifiable code.
NullReferenceExceptionIsNull is .

See Also