Method InsertBefore
InsertBefore(T, T)
Inserts the element in the list before the first occurrence of specified element.
Declaration
bool InsertBefore(T pivot, T value)
Parameters
Type | Name | Description |
---|---|---|
T | pivot | Element before 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 before a given pivot in distributed list.
ICache cache = CacheManager.GetCache("myCache");
string dataTypeName = "DistributedList";
IDistributedList<Product> list = cache.DataTypeManager.GetList<Product>(dataTypeName);
// Get new product
Product newProduct = FetchNewProduct();
list.InsertBefore(list[5], newProduct);