المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : find all possible combinations in a List < List < int > > [modified]



C# Programming
10-06-2009, 07:30 AM
can't figure out a lambada expression that would yield a falttened result of all combinations within the input list of lists



List < List < int > > FindEm(List < List < int > > inputLists) {
var X = ?!?
}


assuming that the input was populated with




List A = new List(new int[] { 1, 2, 3 });
List A = new List(new int[] { 4, 5, 6 });
List A = new List(new int[] { 7, 8, 9 });

List> lists = new List>( );
lists.Add(A);
lists.Add(B);
lists.Add(C);


the result would look something like

1,4,7
1,4,8
1,4,9
2,4,7
.....


any help or direction would be greatly appriciated http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif

modified on Monday, October 5, 2009 1:35 PM