I want to generate a list of all possible combinations of a list of strings (it\'s actually a list of objects, but for simplicity we\'ll use strings). I need this list so th
If you want all variations, have a look at this project to see how it's implemented.
http://www.codeproject.com/Articles/26050/Permutations-Combinations-and-Variations-using-C-G
But you can use it since it's open source under CPOL.
For example:
var allValues = new List() { "A1", "A2", "A3", "B1", "B2", "C1" };
List result = new List();
var indices = Enumerable.Range(1, allValues.Count);
foreach (int lowerIndex in indices)
{
var partVariations = new Facet.Combinatorics.Variations(allValues, lowerIndex);
result.AddRange(partVariations.Select(p => String.Join(" ", p)));
}
var length = result.Count; // 1956