Click or drag to resize

CombinationGetRowsForAllPicks Method

Iterate thru all rows of all Combination tables for every pick in the range (1..Picks).

Namespace:  Kaos.Combinatorics
Assembly:  KaosCombinatorics (in KaosCombinatorics.dll) Version: 6.0.0.0
Syntax
C#
public IEnumerable<Combination> GetRowsForAllPicks()

Return Value

Type: IEnumerableCombination
An iterator for a series of Combination tables.
Examples
C#
using System;
using System.Linq;
using Kaos.Combinatorics;

namespace ExampleApp
{
    // Subclassing is one way to get user-friendly output:
    public class Fruit : Combination
    {
        string[] choices;

        public Fruit (string[] list) : base (list.Length)
        { this.choices = list; }

        public override string ToString()
        { return String.Join (" ", from ei in this select choices[ei]); }
    }

    class CnExample02
    {
        static void Main()
        {
            string[] names = { "apple", "banana", "cherry", "durian" };

            foreach (var basket in new Fruit (names).GetRowsForAllPicks())
                Console.WriteLine (basket);
        }

        /* Output:

        apple
        banana
        cherry
        durian
        apple banana
        apple cherry
        apple durian
        banana cherry
        banana durian
        cherry durian
        apple banana cherry
        apple banana durian
        apple cherry durian
        banana cherry durian
        apple banana cherry durian

        */
    }
}
See Also