using System; using System.Collections; using System.Text; namespace babyApp { /* holds the various Addr objects * a collection of the various Addr objects. Inherets from the * CollectionBase base class. You can add, delete, insert, * find the index of, and see if the collection contains individual * addresses. */ class AddrCollection : CollectionBase { /* gives access to a specific Addr object * * @visible public * @type Addr */ public Addr this[int index] { get { return (Addr)List[index]; } set { List[index] = value; } } /* Add an Addr object to the end of the Collection * * @param Addr object # object to add * @return int */ public int Add(Addr value) { return (List.Add(value)); } /* removes an Addr object from the collection. * Removes based on the value - not the key * * @param Addr object # what to remove * @return void */ public void Remove(Addr value) { List.Remove(value); } /* Insert an Addr object anywhere in the collection * * @param Addr object # what to insert * @return void */ public void Insert(int index, Addr value) { List.Insert(index, value); } /* Find the index of an Addr object * * @param Addr object # what to find * @return int index */ public int IndexOf(Addr value) { return (List.IndexOf(value)); } /* See if the Addr object I am looking for is in the collection * * @param Addr object # what to look for * @return bool */ public bool Contains(Addr value) { // If value is not of type Addr, this will return false. return (List.Contains(value)); } } }