/// <summary> /// Returns the list to which the specified property key is mapped, or /// an empty list if this properties contains no mapping for the property key. /// Note that the empty list is not mapped to the property key. /// </summary> /// <param name="property"> /// the property key whose associated list is to be returned /// </param> /// <returns> /// the list to which the specified property key is mapped, or /// an empty list if this properties contains no mapping for the property key /// </returns> /// <seealso cref= # addListItem( PropertyListKey, Object /// ) /// </seealso> public virtual IList <T> Get <T>(PropertyListKey <T> property) { if (Contains(property)) { return((IList <T>)properties[property.Name]); } return(new List <T>()); }
/// <summary> /// Append the value to the list to which the specified property key is mapped. If /// this properties contains no mapping for the property key, the value append to /// a new list witch is associate the the specified property key. /// </summary> /// @param /// <T> /// the type of elements in the list </param> /// <param name="property"> /// the property key whose associated list is to be added /// </param> /// <param name="value"> /// the value to be appended to list /// </param> public virtual void AddListItem <T>(PropertyListKey <T> property, T value) { var list = Get(property); list.Add(value); if (!Contains(property)) { Set(property, list); } }
/// <summary> /// Returns <code>true</code> if this properties contains a mapping for the specified property key. /// </summary> /// <param name="property"> /// the property key whose presence is to be tested /// </param> /// <returns> <code>true</code> if this properties contains a mapping for the specified property key </returns> public virtual bool Contains <TK>(PropertyListKey <TK> property) { return(properties.ContainsKey(property.Name)); }
/// <summary> /// Associates the specified list with the specified property key. If the properties previously contained a mapping for /// the property key, the old /// value is replaced by the specified list. /// </summary> /// @param /// <T> /// the type of elements in the list </param> /// <param name="property"> /// the property key with which the specified list is to be associated /// </param> /// <param name="value"> /// the list to be associated with the specified property key /// </param> public virtual void Set <T>(PropertyListKey <T> property, IList <T> value) { properties[property.Name] = value; }