} //IndexOf /// <summary> /// Searches the collection for the given Season ID and returns the index. /// If the item is not found in the collection then an ArgumentException /// will be thrown /// </summary> /// <param name="intSeasonID"> /// The ID to search for /// </param> /// <returns> /// The index of the Season ID /// </returns> /// <example> /// <code> /// CSeasonCollection coll = new CSeasonCollection(); /// CSeason temp = new CSeason(); /// coll.Add(temp); /// int intIndex = coll.SearchID(temp.SeasonID); /// </code> /// </example> /// Revision History /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 02/15/06 rrr N/A N/A Creation of class public int SearchID(int intSeasonID) { //Go through the collection checking for matches and return the index //when one is found for (int intIterate = 0; intIterate < InnerList.Count; intIterate++) { CSeason objSeason = (CSeason)InnerList[intIterate]; if (objSeason.ID == intSeasonID) { return(intIterate); } } //If the item was not found then throw an error throw new ArgumentException("The given SeasonID is not in the Collection", "int intSeasonID"); } //SearchID
} //this[] /// <summary> /// Adds a Season to the end of the SeasonCollection /// </summary> /// <param name="objToAdd"> /// The Season to be added /// </param> /// <returns> /// The zero base index of the Season added /// </returns> /// <example> /// <code> /// CSeasonCollection coll = new CSeasonCollection(); /// coll.Add(new CSeason()); /// </code> /// </example> /// Revision History /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 02/15/06 rrr N/A N/A Creation of class public int Add(CSeason objToAdd) { return(InnerList.Add(objToAdd)); } //Add
} //Add /// <summary> /// Adds a Season to the SeasonCollection at the given index /// </summary> /// <param name="intIndex"> /// Index to insert the Season into in the collection /// </param> /// <param name="objToAdd"> /// The Season to be added /// </param> /// <example> /// <code> /// CSeasonCollection coll = new CSeasonCollection(); /// coll.Insert(3, new CSeason()); /// </code> /// </example> /// Revision History /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 02/15/06 rrr N/A N/A Creation of class public void Insert(int intIndex, CSeason objToAdd) { InnerList.Insert(intIndex, objToAdd); } //Insert