/// <summary> /// Adds new item to the internal collection. /// Duplicate items ARE NOT added, but Speller is still notified. /// </summary> /// <param name="item"></param> void ICollection <Uri> .Add(Uri item) { ValidateUri(item); if (!_uriList.Contains(item)) { _uriList.Add(item); } if (Speller != null) { Speller.OnDictionaryUriAdded(item); } }
/// <summary> /// Implementation of Insert method. A restriction added by this implementation is that /// it will throw exception if the item was already added previously. /// This is to avoid ambiguity in respect to the expected position (index) of the inserted item. /// Caller will have to check first if item was already added. /// </summary> /// <param name="index"></param> /// <param name="item"></param> void IList <Uri> .Insert(int index, Uri item) { if (_uriList.Contains(item)) { throw new ArgumentException(SR.Get(SRID.CustomDictionaryItemAlreadyExists), "item"); } ValidateUri(item); _uriList.Insert(index, item); if (Speller != null) { Speller.OnDictionaryUriAdded(item); } }
/// <summary> /// Sets value at specified index. /// Speller is notified that value at the index is being replaced, which means /// current value at given offset is removed, and new value is added at the same index. /// </summary> /// <param name="index"></param> /// <returns></returns> Uri IList <Uri> .this[int index] { get { return(_uriList[index]); } set { ValidateUri(value); Uri oldUri = _uriList[index]; if (Speller != null) { Speller.OnDictionaryUriRemoved(oldUri); } _uriList[index] = value; if (Speller != null) { Speller.OnDictionaryUriAdded(value); } } }