public void addInstrumentPart(ChoralInstrumentPart instrumentPart) { if (instrumentPart == null) { throw new ArgumentNullException("In class ChoralMusicSelection, method AddInstrumentPart(). Argument cannot be null."); } if (this.InstrumentParts.Exists(i => i.InstrumentName == instrumentPart.InstrumentName)) { return; } this.InstrumentParts.Add(instrumentPart); }
public void removeInstrumentPart(ChoralInstrumentPart instrumentPart) { if (instrumentPart == null) { throw new ArgumentNullException("In class ChoralMusicSelection, method AddInstrumentPart(). Argument cannot be null."); } if (this.InstrumentParts.Exists(i => i.InstrumentName == instrumentPart.InstrumentName)) { this.InstrumentParts.RemoveAt(this.InstrumentParts.FindIndex(i => i.InstrumentName == instrumentPart.InstrumentName)); } else { throw new ArgumentException("In class ChoralMusicSelection, method removeInstrumentPart(). Unable to remove instrument part that does not exist in the list."); } }
public override bool Equals(object obj) { // If parameter is null return false. if (obj == null) { return(false); } // If parameter cannot be cast to Tag return false. ChoralInstrumentPart instrumentPart = obj as ChoralInstrumentPart; if ((System.Object)instrumentPart == null) { return(false); } return((this.InstrumentName == instrumentPart.InstrumentName) && (this.NumberOfCopies == instrumentPart.NumberOfCopies) && (this.IsInChoralScore == instrumentPart.IsInChoralScore)); }