Edit

Share via


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)

Source:
Buffer.cs
Source:
Buffer.cs
Source:
Buffer.cs

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.

C#
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
public static void MemoryCopy(void* source, void* destination, long destinationSizeInBytes, long sourceBytesToCopy);
C#
[System.CLSCompliant(false)]
public static void MemoryCopy(void* source, void* destination, long destinationSizeInBytes, long sourceBytesToCopy);

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

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0

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

Source:
Buffer.cs
Source:
Buffer.cs
Source:
Buffer.cs

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.

C#
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
public static void MemoryCopy(void* source, void* destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy);
C#
[System.CLSCompliant(false)]
public static void MemoryCopy(void* source, void* destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy);

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

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0