First, you'll need some of methods to permute an array of integers. F.e. you can try this:
public static IEnumerable<int[]> Permutations(int start, int count)
{
if (count == 0)
yield break;
var array = Enumerable.Range(start, count)
.ToArray();
if (count > 1)
{
do
yield return array;
while (NextPermutation(ref array));
}
else
yield return array;
}
private static bool NextPermutation(ref int[] array)
{
int k = array.Length - 2;
while (k >= 0)
{
if (array[k] < array[k + 1])
break;
k--;
}
if (k < 0)
return false;
int l = array.Length - 1;
while (l > k)
{
if (array[k] < array[l])
break;
l--;
}
int tmp = array[k];
array[k] = array[l];
array[l] = tmp;
Array.Reverse(array, k + 1, array.Length - k - 1);
return true;
}
This method looks complicated, but it's most efficient of existing methods.
Then you'll can use permutated integers as indices:
IReadOnlyList<string> words = ...
IEnumerable<int[]> permutations = Permutations(0, words.Length);
foreach (var permutation in permutations)
{
var nextCase = new string[permutation.Length];
for (int i = 0; i < permutation.Length; i++)
nextCase[i] = words[permutation[i]];
var result = string.Join("", nextCase);
Console.WriteLine(result);
}