Method AddRange
AddRange(IEnumerable<T>)
Adds the elements of the specified collection to the end of the List<T>
Declaration
void AddRange(IEnumerable<T> collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | collection | The collection whose elements should be added to the end of the List<T> |
Examples
The following code sample shows how to add multiple of items to distributed list.
ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedList";
IDistributedList<Product> list = cache.DataTypeManager.GetList<Product>(dataTypeName);
// Get new products
Product[] newProducts = new Product[2];
newProducts[0] = new Product { Id = 1, Name = "Chai" };
newProducts[1] = new Product { Id = 2, Name = "Chang" };
newProducts[2] = new Product { Id = 3, Name = "Aniseed Syrup" };
list.AddRange(newProducts);