Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library

SafeBuffer.Write<T> Method

Writes a value type to memory at the given location.

This API is not CLS-compliant. 

Namespace:  System.Runtime.InteropServices
Assemblies:   mscorlib (in mscorlib.dll)
  System.Runtime.InteropServices (in System.Runtime.InteropServices.dll)

[CLSCompliantAttribute(false)]
public void Write<T>(
	ulong byteOffset,
	T value
)
where T : struct

Type Parameters

T

The value type to write.

Parameters

byteOffset
Type: System.UInt64

The location at which to start writing. You may have to consider alignment issues.

value
Type: T

The value to write.

ExceptionCondition
InvalidOperationException

The Initialize method has not been called.

This method is equivalent to the following code:

*(T*)(bytePtr + byteOffset) = value;

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

.NET for Windows Phone apps

Supported in: Windows Phone 8.1

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft