Unsafe.Write<T>(Void*, T) Method

Definition

Important

This API is not CLS-compliant.

Writes a value of type T to the given location.

public:
generic <typename T>
 static void Write(void* destination, T value);
public static void Write<T> (void* destination, T value);
[System.CLSCompliant(false)]
public static void Write<T> (void* destination, T value);
static member Write : nativeptr<unit> * 'T -> unit
[<System.CLSCompliant(false)>]
static member Write : nativeptr<unit> * 'T -> unit

Type Parameters

T

The type of the value to write.

Parameters

destination
Void*

The location to write to.

value
T

The value to write.

Attributes

Remarks

Caution

The caller must ensure that there are SizeOf<T>() bytes of writable memory available starting at the location pointed to by destination. Access violations may occur if this requirement is not met.

destination is assumed to be a properly aligned pointer to a value of type T. For more information on alignment assumptions, see ECMA-335, Sec. I.12.6.2 ("Alignment").

Applies to