System.Runtime.InteropServices.Marshal.WriteByte Method

Writes a single byte value to unmanaged memory.

Syntax

public static void WriteByte (IntPtr ptr, byte val)

Parameters

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

Remarks

Marshal.WriteByte(IntPtr, int, byte) enables direct interaction with an unmanaged C-style byte 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.

Requirements

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