c# - Get all combinatiion of Items of n number of lists -


i have list contains further sub lists , have objects stored in sub list. want generate possible combinations of elements.

e.g. have list contains 2 list l1,l2 , have different objects stored in example l1 contains {obj1,obj2} l2 contains {obj3,obj4}

then result should come in form of

{obj1,obj3} {obj1,obj4} {obj2,obj3} {obj2,obj4} 

all lists being generated dynamically. solution should generic irrespective of count of elements in main list , sub list

l1.selectmany(l1 => l2.select(l2 => tuple.create(l1, l2))).tolist();


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -