Buffer Class


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Manipulates arrays of primitive types.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

type Buffer = class end

System_CAPS_pubmethodSystem_CAPS_staticBlockCopy(Array, Int32, Array, Int32, Int32)

Copies a specified number of bytes from a source array starting at a particular offset to a destination array starting at a particular offset.


Returns the number of bytes in the specified array.

System_CAPS_pubmethodSystem_CAPS_staticGetByte(Array, Int32)

Retrieves the byte at a specified location in a specified array.

System_CAPS_pubmethodSystem_CAPS_staticMemoryCopy(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.

System_CAPS_pubmethodSystem_CAPS_staticMemoryCopy(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.

System_CAPS_pubmethodSystem_CAPS_staticSetByte(Array, Int32, Byte)

Assigns a specified value to a byte at a particular location in a specified array.

Buffer only affects arrays of primitive types; this class does not apply to objects. Each primitive type is treated as a series of bytes without regard to any behavior or limitation associated with the primitive type.

Buffer provides methods to copy bytes from one array of primitive types to another array of primitive types, get a byte from an array, set a byte in an array, and obtain the length of an array. This class provides better performance for manipulating primitive types than similar methods in the System.Array class.

Buffer is applicable to the following primitive types: Boolean, Char, SByte, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, IntPtr, UIntPtr, Single, and Double.

The following code example illustrates the use of several Buffer class methods.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top