How to convert the result of LINQ query to List
Hello,
Here is function, that I use the list of permutations:
public static IEnumerable<IEnumerable<T>> Permute<T>(IEnumerable<T> list)
{
if (list.Count() == 1)
return new List<IEnumerable<T>> { list };
return list.Select((a, i1) => Permute(
list.Where((b, i2) => i2 != i1)).Select(
b => (new List<T> { a }).Union(b))
).SelectMany(c => c);
}
I use it in the following way:
var SFP_vars = Permute(SFP);
Where SFP is array of bytes:
byte[] SFP = new byte[7] { 0, 1, 2, 3, 4, 5, 6 };
There is other variable:
List<byte[]> lst_SFP = new List<byte[]>();
Now my question: How to assign the value of SFP_vars to lst_SFP ?
lst_SFP = SFP_vars.ToList() doesn't work.
Thanks in advance.
Pavel.