| CombinationPermuteT Method |
Apply a
Combination sequence to rearrange the supplied list or array.
Namespace:
Kaos.Combinatorics
Assembly:
KaosCombinatorics (in KaosCombinatorics.dll) Version: 6.0.0.0
Syntax public static List<T> Permute<T>(
Combination arrangement,
IList<T> source
)
Parameters
- arrangement
- Type: Kaos.CombinatoricsCombination
New arrangement for items. - source
- Type: System.Collections.GenericIListT
List of items to rearrange.
Type Parameters
- T
- Type of items to rearrange.
Return Value
Type:
ListTList of rearranged items.
Exceptions Examples using System;
using Kaos.Combinatorics;
namespace ExampleApp
{
public class Furniture
{
public string Name { get; private set; }
public Furniture (string name) { Name = name; }
public override string ToString() => Name;
}
public class Fruit
{
public string Name { get; private set; }
public Fruit (string name) { Name = name; }
public override string ToString() => Name;
}
class CnExample03
{
static void Main()
{
object[] things =
{
new Fruit ("apple"),
new Furniture ("bench"),
new Furniture ("chair"),
new Fruit ("durian"),
new Fruit ("eggplant")
};
foreach (var row in new Combination (things.Length, 3).GetRows())
Console.WriteLine (String.Join (" ", Combination.Permute (row, things)));
}
}
}
See Also