public List <Instrument> InstrumentSelectForTone(Selection s) { String caseTone = s.PreferredTone; foreach (Instrument i in instrumentRepo.GetInstrumentsByTone(caseTone)) { bool add = true; foreach (Instrument j in toneInstruments) { if (i.DescriptionText.Equals(j.DescriptionText)) { add = false; break; } } if (add) { toneInstruments.Add(i); } } /* * List<Instrument> toneInstrument1 = new List<Instrument>(); * // Switch * switch (caseTone) * { * case "0": * toneInstrument1 = instrumentRepo.GetInstrumentsByTone("0"); * break; * case "1": * toneInstrument1 = instrumentRepo.GetInstrumentsByTone("1"); * break; * case "2": * toneInstrument1 = instrumentRepo.GetInstrumentsByTone("2"); * break; * case "3": * toneInstrument1 = instrumentRepo.GetInstrumentsByTone("3"); * break; * case "4": * toneInstrument1 = instrumentRepo.GetInstrumentsByTone("4"); * break; * } * foreach (Instrument instrument in toneInstrument1) * { * if (!toneInstruments.Contains(instrument)) * { * toneInstruments.Add(instrument); * } * }*/ return(toneInstruments); }