打印列表排列

问题描述

| 我(在C#中)有一个对象列表(每个对象都包含一个列表),我想打印出对象列表中各项的每个排列。每次迭代将使用每个列表中的一项。实现这一目标的最有效方法是什么?欢迎使用伪代码
public class Detail {

    public int type;
    public List<String> codes;

    public Detail(int i){

        this.type = i;
        this.codes = new List<String>();

    }

}
稍后的...
List<Detail> listofDetail = new List<Detail>();
foreach(Field i in listBox.Items)
    listofDetail.Add(new Detail(i));
数据库分配的代码列表可以是2到250之间的任何值。 如果我有3个对象(A,B和C),其中A持有1,2,3,B持有4,5,6,C持有7,8,9,我希望它打印以下内容
147
148
149
157
158
159
167
etc...
    

解决方法

        如果我正确地关注您,则需要这样的内容: 更新:
foreach(var secondaryList in primaryListOfObjects) {
    StringBuilder sb = new StringBuilder();
    foreach(var str in secondaryList) {
        sb.Append(str);
    }
    Console.WriteLine(sb.ToString());
}