Method RemoveRange
RemoveRange(Int32, Int32)
Removes a range of elements from the List<T>.
Declaration
void RemoveRange(int index, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based starting index of the range of elements to remove. |
System.Int32 | count | The number of elements to remove. |
Examples
The following code sample shows how to remove multiple of items from Distributed List.
ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedList";
IDistributedList<Product> list = cache.DataTypeManager.GetList<Product>(dataTypeName);
list.RemoveRange(25, 50);
RemoveRange(IEnumerable<T>)
Removes the elements of the specified collection from the List<T>.
Declaration
int RemoveRange(IEnumerable<T> collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | collection | The collection whose elements should be removed from the List<T> |
Returns
Type | Description |
---|---|
System.Int32 | The number of removed elements. |
Examples
The following code sample shows how to remove multiple of specified items from Distributed List.
ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedList";
IDistributedList<Product> list = cache.DataTypeManager.GetList<Product>(dataTypeName);
// Get range of expired products to be removed
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" };
int itemsRemoved = list.RemoveRange(newProducts);