Method InsertAfter
InsertAfter(T, T)
Inserts the element in the list after the first occurrence of specified element.
Declaration
bool InsertAfter(T pivot, T value)
Parameters
Type | Name | Description |
---|---|---|
T | pivot | Element after which value will be inserted. |
T | value | Element to insert in the list. |
Returns
Type | Description |
---|---|
System.Boolean | False when the value pivot was not found; else true. |
Examples
The following code sample shows how to insert a value after a given pivot in 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.InsertAfter(list[5], newProduct);