System.Runtime.InteropServices.Marshal.WriteInt32 Method

Writes a 32-bit signed integer value to unmanaged memory.

Syntax

public static void WriteInt32 (IntPtr ptr, int val)

Parameters

ptr
The address in unmanaged memory to write to.
val
The value to write.

Remarks

Marshal.WriteInt32(IntPtr, int, int) enables direct interaction with an unmanaged 32-bit signed array, eliminating the expense of copying an entire unmanaged array (using Marshal.Copy(Int32[], int, IntPtr, int)) to a separate managed array before setting its element values.

Writing to unaligned memory locations is supported.

Requirements

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0