/// <summary> /// Remove associations specified by array of name-value pair for this item. /// </summary> /// <param name="item">source item</param> /// <param name="pairs">array of name-value pairs</param> /// <returns>number of removed associations </returns> public int Unlink(Item item, Pair[] pairs) { int nUnlinked = 0; for (int i = 0; i < pairs.Length; i++) { if (Unlink(item, pairs[i].Name, pairs[i].Value)) { nUnlinked += 1; } } return nUnlinked; }
/// <summary> /// Update association using given array of name-value pairs /// If there are no attributes with the given name associated with this item, then this method just adds new associations. /// If there are more than one associations with the given name, then first of them is updated /// </summary> /// <param name="item">source item</param> /// <param name="pairs">array of name-value pairs</param> public void Update(Item item, Pair[] pairs) { for (int i = 0; i < pairs.Length; i++) { Update(item, pairs[i]); } }
/// <summary> /// Remove association specified by name-value pair for this item. /// </summary> /// <param name="item">source item</param> /// <param name="pair">name-value pair</param> /// <returns>true if association with such name and value exists for this item, false otherwise</returns> public bool Unlink(Item item, Pair pair) { return Unlink(item, pair.Name, pair.Value); }
/// <summary> /// Update association using given name-value pair /// This operation is analog of replacing an array element /// </summary> /// <param name="item">source item</param> /// <param name="pair">name-value pair</param> /// <param name="position">position at which new value should be inserted</param> /// <returns>true if value is successfully updated, false if specified position doesn't belong to "array"</returns> public bool UpdateAt(Item item, Pair pair, int position) { return UpdateAt(item, pair.Name, pair.Value, position); }
/// <summary> /// Update association using given name-value pair /// If there are no attributes with the given name associated with this item, then this method just adds new association. /// If there are more than one associations with the given name, then first of them is updated /// </summary> /// <param name="item">source item</param> /// <param name="pair">name-value pair</param> public void Update(Item item, Pair pair) { Update(item, pair.Name, pair.Value); }
/// <summary> /// Associate new name-value pairs with this item /// </summary> /// <param name="item">source item</param> /// <param name="pairs">array of name-value pair</param> public void Link(Item item, Pair[] pairs) { for (int i = 0; i < pairs.Length; i++) { Link(item, pairs[i]); } }
/// <summary> /// Associate new name-value pair with this item at given position /// This operation is analog of insertion in an array at specified position. /// </summary> /// <param name="item">source item</param> /// <param name="pair">name-value pair</param> /// <param name="position">position at which new value should be inserted</param> /// <returns>true if value is successfully inserted or false if it can not be inserted at this position (position is more than one greater /// than "array" size)</returns> public bool LinkAt(Item item, Pair pair, int position) { return LinkAt(item, pair.Name, pair.Value, position); }
/// <summary> /// Associate new name-value pair with this item /// </summary> /// <param name="item">source item</param> /// <param name="pair">name-value pair</param> public void Link(Item item, Pair pair) { Link(item, pair.Name, pair.Value); }