Method CopyTo
CopyTo(T[], Int32)
Copies the IQueue elements to the specified array, starting at the specified index.
Declaration
void CopyTo(T[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The destination array of the elements copied from IQueue. |
System.Int32 | arrayIndex | The zero-based index in array at which copying begins. |
Examples
The following code sample shows how to copy the entire source queue to the target Array starting at 0th index.
ICache cache = CacheManager.GetCache("myCache");
string dataTypeName = "DistributedQueue";
IDistributedQueue<Product> queue = cache.DataTypeManager.GetQueue<Product>(dataTypeName);
Product[] products = new Product[queue.Count];
queue.CopyTo(products, 0);