Share via


XboxLiveDeviceAddress.GetSnapshotAsBytes(Byte[], UInt32) Method

Definition

Saves an XboxLiveDeviceAddress to an array of bytes.

You can use this method to save a snapshot for use with the XboxLiveDeviceAddress.CreateFromSnapshotBytes method.

Important

This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime.

public:
 virtual void GetSnapshotAsBytes(Platform::Array <byte> ^ buffer, [Out] unsigned int & bytesWritten) = GetSnapshotAsBytes;
void GetSnapshotAsBytes(winrt::array_view <byte> & buffer, [Out] uint32_t & bytesWritten);
public void GetSnapshotAsBytes(byte[] buffer, out uint bytesWritten);
Public Sub GetSnapshotAsBytes (buffer As Byte(), ByRef bytesWritten As UInteger)

Parameters

buffer

Byte[]

byte[]

The array of bytes to receive the snapshot.

Use the XboxLiveDeviceAddress.MaxSnapshotBytesSize property to determine the proper size of the array you pass.

bytesWritten
UInt32

unsigned int

uint32_t

On successful completion, the number of bytes in the snapshot. On failure, -1.

Remarks

Snapshots are serialized forms of XboxLiveDeviceAddress objects that can be transmitted to remote devices through out-of-band channels such as Xbox Live matchmaking. However, they represent a device's network address information at a particular time, and they can change over time. To avoid unnecessary connectivity problems, you should listen for XboxLiveDeviceAddress.SnapshotChanged events on the local device address to know when its snapshot contents have been updated, and refresh the serialized snapshot anywhere you've transmitted or cached it, so that remote devices always have the latest information.

Applies to