Here is function, that I use the list of permutations:
public static IEnumerable
{
if (list.Count() == 1)
return new List
return list.Select((a, i1) => Permute(
list.Where((b, i2) => i2 != i1)).Select(
b => (new List
).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
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.


VulpesRank #55 · 29.2K reputationPosted Sep 20, 2012, 12:47 AM EDT
VulpesRank #55 · 29.2K reputationPosted Sep 20, 2012, 12:23 AM EDT
Pavel106 reputationPosted Sep 20, 2012, 12:34 AM EDT
One question (just for curiosity) - for what usage the function ToList() stands for ?
The SFP_vars is sequence of objects of type byte[]. The variable lst_SFP is the list of the objects of the same type. Why simple conversion isn't possible and therefore one need to employ a loop ?
Pavel106 reputationPosted Sep 20, 2012, 1:00 AM EDT
VulpesRank #55 · 29.2K reputationPosted Sep 20, 2012, 1:08 AM EDT
Without doing any actual testing, my guess would be that the second variant is slightly slower than the first because there's an extra method call, but the difference should be negligible.
Pavel106 reputationPosted Sep 20, 2012, 1:23 AM EDT