/// <summary> /// Removes an object from the collection. /// </summary> /// <param name="key">The key of the object to remove</param> protected void Remove(KeyBase key) { innerList.Remove(key); // Remove it from the key map as well keyMap.Remove(key.Id); }
/// <summary> /// Adds a new object to the collection. /// </summary> /// <param name="key">The key of the object.</param> /// <param name="obj">The object to add</param> protected void Add(KeyBase key, PhotoObjectBase obj) { innerList.Add(key, obj); // Keep a map of the keys to the IDs keyMap.Add(obj.Id, key); }
public PhotoObjectBase this[int id] { get { KeyBase base2 = (KeyBase)this.keyMap[id]; return((PhotoObjectBase)this.innerList[base2]); } }
/// <summary> /// The indexer for the PhotoCollectionBase collection class. /// </summary> public PhotoObjectBase this[int id] { get { // Use the kay map to retrieve the KeyBase object based upon the // ID of the PhotoObjectBase KeyBase key = (KeyBase)keyMap[id]; return((PhotoObjectBase)innerList[key]); } }
public void Add(Comment comment) { KeyBase key = this.CreateKey(comment); base.Add(key, comment); }
public void Add(Photo photo) { KeyBase key = this.CreateKey(photo); base.Add(key, photo); }
/// <summary> /// Adds a PhotoDirectory object to the collection. /// </summary> /// <param name="photoDirectory">The PhotoDirectory object to add.</param> public void Add(PhotoDirectory photoDirectory) { KeyBase key = CreateKey(photoDirectory); Add(key, photoDirectory); }
public void Add(PhotoDirectory photoDirectory) { KeyBase key = this.CreateKey(photoDirectory); base.Add(key, photoDirectory); }
/// <summary> /// Adds a Comment object to the collection. /// </summary> /// <param name="comment">The Comment object to add.</param> public void Add(Comment comment) { KeyBase key = CreateKey(comment); Add(key, comment); }
/// <summary> /// Returns the zero-based index of the specified key in the PhotosCollectionBase. /// </summary> /// <param name="key">The key to locate in the PhotosCollectionBase. </param> /// <returns>The zero-based index of key, if key is found in the PhotosCollectionBase; otherwise, -1.</returns> public int IndexOf(PhotoObjectBase obj) { KeyBase key = CreateKey(obj); return(innerList.IndexOfKey(key)); }
/// <summary> /// Adds a Photo object to the collection. /// </summary> /// <param name="photo">The Photo object to add.</param> public void Add(Photo photo) { KeyBase key = CreateKey(photo); Add(key, photo); }
protected void Remove(KeyBase key) { this.innerList.Remove(key); this.keyMap.Remove(key.Id); }
protected void Add(KeyBase key, PhotoObjectBase obj) { this.innerList.Add(key, obj); this.keyMap.Add(obj.Id, key); }