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

**URL:** <https://forum.dynamobim.com/t/creating-a-list-from-two-lists-with-all-possible-combinations-of-elements/11082>\
**Category:** Lists-Logic\
**Created:** [April 16, 2017, 12:26pm UTC](https://forum.dynamobim.com/t/creating-a-list-from-two-lists-with-all-possible-combinations-of-elements/11082 "2017-04-16T12:26:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilya\_Kirichenko](https://avatars.discourse-cdn.com/v4/letter/i/f475e1/32.png) [@Ilya\_Kirichenko](https://forum.dynamobim.com/u/Ilya_Kirichenko)\
**Post date:** [April 16, 2017, 12:26pm UTC](https://forum.dynamobim.com/t/creating-a-list-from-two-lists-with-all-possible-combinations-of-elements/11082/1 "2017-04-16T12:26:06Z")

</div>

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.

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/6/465929dcd911ebb0a0eeda272dd755cca9a8944c.png)[2017-04-16.dyn](https://forum.dynamobim.com/uploads/short-url/mCtpsmFN4BEyb31QeC6XyAbRQ3s.dyn) (7.5 KB)

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [April 16, 2017, 1:44pm UTC](https://forum.dynamobim.com/t/creating-a-list-from-two-lists-with-all-possible-combinations-of-elements/11082/2 "2017-04-16T13:44:19Z")

</div>

![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/3X/c/2/c294c40063862af353688ca26ac86b87e2865779.png)

---

<div class="post-metadata">

**Author:** ![Ilya\_Kirichenko](https://avatars.discourse-cdn.com/v4/letter/i/f475e1/32.png) [@Ilya\_Kirichenko](https://forum.dynamobim.com/u/Ilya_Kirichenko)\
**Post date:** [April 16, 2017, 1:45pm UTC](https://forum.dynamobim.com/t/creating-a-list-from-two-lists-with-all-possible-combinations-of-elements/11082/3 "2017-04-16T13:45:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Einar\_Raknes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/einar_raknes/32/8566_2.png) [@Einar\_Raknes](https://forum.dynamobim.com/u/Einar_Raknes)\
**Post date:** [April 16, 2017, 3:42pm UTC](https://forum.dynamobim.com/t/creating-a-list-from-two-lists-with-all-possible-combinations-of-elements/11082/4 "2017-04-16T15:42:36Z")

</div>

> [@Ilya\_Kirichenko](#):
>
> But what’s the logic behind it? why concat and join don’t work?

Here is the explanation from one of the developers:

> [@Concatenate list of string](https://forum.dynamobim.com/t/concatenate-list-of-string/10354/8):
>
> @Einar_Raknes@Carlo_Beltracchi String.Join and String.Concat are based off of the .net class, string. The .net class has several overloads for both Join and Concat. [image] [image] Depending on what arguments you feed into the nodes, the system makes its best guess as to what you want to happen. The problem is that the UI doesn’t necessarily match what is happening in the backend. [image] For instance, both the String.Join and String.Concat nodes ask for string[] in the string0 input. Th…

---

<div class="post-metadata">

**Author:** ![Einar\_Raknes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/einar_raknes/32/8566_2.png) [@Einar\_Raknes](https://forum.dynamobim.com/u/Einar_Raknes)\
**Post date:** [April 16, 2017, 3:51pm UTC](https://forum.dynamobim.com/t/creating-a-list-from-two-lists-with-all-possible-combinations-of-elements/11082/5 "2017-04-16T15:51:43Z")

</div>

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

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/0/b03f70f66a69f0e8c5205ca101dd2ac8575c1bdd.png)

---

<div class="post-metadata">

**Author:** ![Ilya\_Kirichenko](https://avatars.discourse-cdn.com/v4/letter/i/f475e1/32.png) [@Ilya\_Kirichenko](https://forum.dynamobim.com/u/Ilya_Kirichenko)\
**Post date:** [April 20, 2017, 6:33pm UTC](https://forum.dynamobim.com/t/creating-a-list-from-two-lists-with-all-possible-combinations-of-elements/11082/6 "2017-04-20T18:33:01Z")

</div>

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