public static IEnumerable <IEnumerable <int> > ChooseStringIndeces(int indecesToReplace, int stringStartLength) { var key = new IndexDictionaryKey(indecesToReplace, stringStartLength); if (IndexDictionary.ContainsKey(key)) { return(IndexDictionary[key]); } var indexCombination = new List <string>(); for (int i = 0; i < stringStartLength; i++) { indexCombination.Add(i.ToString()); } var combinations = new List <string>(); Choose("", indecesToReplace, indexCombination, combinations); var value = combinations.Select(i => i.Select(c => Int32.Parse(c.ToString()))); IndexDictionary.Add(key, value); return(value); }
public static IEnumerable<IEnumerable<int>> ChooseStringIndeces(int indecesToReplace, int stringStartLength) { var key = new IndexDictionaryKey(indecesToReplace, stringStartLength); if (IndexDictionary.ContainsKey(key)) return IndexDictionary[key]; var indexCombination = new List<string>(); for (int i = 0; i < stringStartLength; i++) { indexCombination.Add(i.ToString()); } var combinations = new List<string>(); Choose("", indecesToReplace, indexCombination, combinations); var value = combinations.Select(i => i.Select(c => Int32.Parse(c.ToString()))); IndexDictionary.Add(key, value); return value; }