コード例 #1
0
        public static T[][] GetSimpleCombinations <T>(this ICollection <T> collection, int numberOfElementsPerCombination)
        {
            T[][] result = new T[NumberOfSimpleCombinations(numberOfElementsPerCombination, collection)][];
            int   index  = 0;

            Loops.ForCombo <T>(numberOfElementsPerCombination, collection,
                               (T[] a) => { result[index] = a; index++; }, false, false);
            return(result);
        }
コード例 #2
0
        public static T[][] GetPermutationsWithReplacement <T>(this ICollection <T> collection, int numberOfElementsPerCombination)
        {
            T[][] result = new T[NumberOfPermutationsWithReplacement <T>(numberOfElementsPerCombination, collection)][];
            int   index  = 0;

            Loops.ForCombo <T>(numberOfElementsPerCombination, collection,
                               (T[] a) => { result[index] = a; index++; }, false, true);
            return(result);
        }