Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CryptographicBuffer.CopyToByteArray | copyToByteArray method

Applies to Windows and Windows Phone

Copies a buffer to an array of bytes.

Syntax


Windows.Security.Cryptography.CryptographicBuffer.copyToByteArray(buffer);

Parameters

buffer

Type: IBuffer

Input buffer.

value (out parameter)

Type: array of Number [JavaScript] | System.Byte[] [.NET] | Platform::Array<uint8> [C++]

An array of bytes that contains the values copied from the input buffer. You must declare the array before calling this method and pass it by using the ref keyword. If the buffer for the input parameter is empty, then the value parameter will be returned as NULL.

Examples


public void ByteArrayCopy()
{
    // Initialize a byte array.
    byte[] arrByte = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

    // Create a buffer from the byte array.
    IBuffer buffer = CryptographicBuffer.CreateFromByteArray(arrByte);

    // Encode the buffer into a hexadecimal string (for display);
    String strHex = CryptographicBuffer.EncodeToHexString(buffer);

    // Copy the buffer back into a new byte array.
    byte[] arrByteNew;
    CryptographicBuffer.CopyToByteArray(buffer, out arrByteNew);
}


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.Security.Cryptography
Windows::Security::Cryptography [C++]

Metadata

Windows.winmd

See also

CryptographicBuffer

 

 

Show:
© 2014 Microsoft