public class CrossPoint
{
private class Color
{
public string Name { get; }
public Color(string name)
{
Name = name;
}
}
[Fact]
public void Test1()
{
var list1 = new List<Color>() { new Color("Green"), new Color("Black") };
var list2 = new List<Color>() { new Color("Orange"), new Color("Red") , new Color("Blue") };
var list3 = new List<Color>() { new Color("Yellow"), new Color("Pink") };
var CompleteList = new List<List<Color>>();
CompleteList.Add(list1);
CompleteList.Add(list2);
CompleteList.Add(list3);
var result = Result(CompleteList);
/*
Green, Orange, Yellow,
Green, Orange, Pink,
Green, Red, Yellow,
Green, Red,Pink,
Green, Blue, Yellow,
Green, Blue, Pink,
Black, Orange, Yellow,
Black, Orange, Pink,
Black, Red, Yellow,
Black, Red,Pink,
Black, Blue, Yellow,
Black, Blue, Pink,
*/
}
private Color[,] Result(List<List<Color>> colors) {
// Do Something
return new Color[1, 1];
}
}
Asked
Active
Viewed 82 times
0

TheGeneral
- 79,002
- 9
- 103
- 141

user1742179
- 87
- 1
- 5
-
1Sorry i misunderstood your question, can explain what you are trying to do a bit more. – TheGeneral Nov 02 '21 at 05:52
-
im looking for the answer of the DoSomething comment basically how to do a cartesian product i think is called for an N Number of lists with different number of elements in each list – user1742179 Nov 02 '21 at 06:09
-
1See if this helps: https://stackoverflow.com/questions/25643382/cartesian-products-with-n-number-of-list/25643434 – Yash Gupta Nov 02 '21 at 06:11
-
@Enigmativity I don't agree with the target; Yash's proposal is better. I've added it, but not removed yours – Caius Jard Nov 02 '21 at 06:34
-
2@user1742179 I believe you can use yash' proposal with just some minor work to turn it into a 2D array (but.. euww, 2D arrays.. I'd leave it as an `IE
>` – Caius Jard Nov 02 '21 at 06:38 -
@CaiusJard - Fair enough. You're right. – Enigmativity Nov 02 '21 at 08:58