private static void GetUniquePeptides_helper(IList <QuantitationChannelSet> sets, int setIndex, HashSet <IQuantitationChannel> channels, List <HashSet <IQuantitationChannel> > result) { if (setIndex >= sets.Count) { result.Add(new HashSet <IQuantitationChannel>(channels)); } else { QuantitationChannelSet currentSet = sets[setIndex]; foreach (IQuantitationChannel channel in currentSet.GetChannels()) { channels.Add(channel); GetUniquePeptides_helper(sets, setIndex + 1, channels, result); channels.Remove(channel); } } }