I have a question related to the combination.
I am actually engaged in the development of an e-commerce site, and I have a feature that allows the client to create a product.
For example: Black Pant 34W 30L, Black Pant 38W 32L, White Pant 34W 30l. They are defined as product options.
Suppose my pants have 3 options, and they are color, size and waist length.
Now I have 3 lists.
ListA = {"black", "white", "red"}
My question is, how can I list all possible combinations?
My desired result should look like {{black, 30,28}, {black, 30,30}, {black, 30,32}, {white, 34, 30}}
PS The hard part is that I donβt know how many options the client will assign to this product. The counter can be only 1, which is the simplest; it can be more than 3 ...
Problem resolved
Since we do not know how many options we will have. Therefore, we do not know how many cycles we will use. In other words, he refers to typical Cartesian works.
For more information, you can read these two links. http://www.interact-sw.co.uk/iangblog/2010/07/28/linq-cartesian-1 http://blogs.msdn.com/b/ericlippert/archive/2010/06/28/computing -a-cartesian-product-with-linq.aspx
Thank you for your help!