Buffer.MemoryCopy Method

Definition

Copies a block of memory.

Overloads

MemoryCopy(Void*, Void*, Int64, Int64)

Copies a number of bytes specified as a long integer value from one address in memory to another.

This API is not CLS-compliant.

MemoryCopy(Void*, Void*, UInt64, UInt64)

Copies a number of bytes specified as an unsigned long integer value from one address in memory to another.

This API is not CLS-compliant.

MemoryCopy(Void*, Void*, Int64, Int64)

Important

This API is not CLS-compliant.

Copies a number of bytes specified as a long integer value from one address in memory to another.

This API is not CLS-compliant.

public:
 static void MemoryCopy(void* source, void* destination, long destinationSizeInBytes, long sourceBytesToCopy);
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
public static void MemoryCopy (void* source, void* destination, long destinationSizeInBytes, long sourceBytesToCopy);
[System.CLSCompliant(false)]
public static void MemoryCopy (void* source, void* destination, long destinationSizeInBytes, long sourceBytesToCopy);
[<System.CLSCompliant(false)>]
[<System.Security.SecurityCritical>]
static member MemoryCopy : nativeptr<unit> * nativeptr<unit> * int64 * int64 -> unit
[<System.CLSCompliant(false)>]
static member MemoryCopy : nativeptr<unit> * nativeptr<unit> * int64 * int64 -> unit

Parameters

source
Void*

The address of the bytes to copy.

destination
Void*

The target address.

destinationSizeInBytes
Int64

The number of bytes available in the destination memory block.

sourceBytesToCopy
Int64

The number of bytes to copy.

Attributes

Exceptions

sourceBytesToCopy is greater than destinationSizeInBytes.

Remarks

This method copies sourceBytesToCopy bytes from the address specified by source to the address specified by destination. If some regions of the source area and the destination overlap, the function ensures that the original source bytes in the overlapping region are copied before being overwritten.

Applies to

MemoryCopy(Void*, Void*, UInt64, UInt64)

Important

This API is not CLS-compliant.

Copies a number of bytes specified as an unsigned long integer value from one address in memory to another.

This API is not CLS-compliant.

public:
 static void MemoryCopy(void* source, void* destination, System::UInt64 destinationSizeInBytes, System::UInt64 sourceBytesToCopy);
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
public static void MemoryCopy (void* source, void* destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy);
[System.CLSCompliant(false)]
public static void MemoryCopy (void* source, void* destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy);
[<System.CLSCompliant(false)>]
[<System.Security.SecurityCritical>]
static member MemoryCopy : nativeptr<unit> * nativeptr<unit> * uint64 * uint64 -> unit
[<System.CLSCompliant(false)>]
static member MemoryCopy : nativeptr<unit> * nativeptr<unit> * uint64 * uint64 -> unit

Parameters

source
Void*

The address of the bytes to copy.

destination
Void*

The target address.

destinationSizeInBytes
UInt64

The number of bytes available in the destination memory block.

sourceBytesToCopy
UInt64

The number of bytes to copy.

Attributes

Exceptions

sourceBytesToCopy is greater than destinationSizeInBytes.

Remarks

This method copies sourceBytesToCopy bytes from the address specified by source to the address specified by destination. If some regions of the source area and the destination overlap, the function ensures that the original source bytes in the overlapping region are copied before being overwritten.

Applies to