Creating a list from two lists with all possible combinations of elements

Hello guys,
I have two lists of strings: {“A”,“B”,“C”,“D”}; and {“0”,“1”,“2”,“3”}; I need to join them, so i get a two dimensionl list {{“A0”,“A1”,“A2”,“A3”},{“B0”,“B1”,“B2”,“B3”},{“C0”,“C1”,“C2”,“C3”},{“D0”,“D1”,“D2”,“D3”}};
I thought I could use String.Concat with cross-product lacing. but whatever lacing I use, I get two lists ABCD and 0123.
If I use list join, I only get {A0,B1,C2,D3}
What is the best way to solve this?
I need the solution for long lists with n elements.

2017-04-16.dyn (7.5 KB)

3 Likes

Thank You!
But what’s the logic behind it? why concat and join don’t work?

1 Like

Here is the explanation from one of the developers:

2 Likes

If you really want to use String.Concat or .Join you can blow the dust of the good old List.CatesianProduct:

3 Likes

Thanks for elaborate answer.
I don’t understand what “.net class” is. But I guess it is a topic of deeper programming structure.