日期:2014-05-17  浏览次数:20838 次

还是数组拼接
C# code
List<string> one = new List<string>{"0101","0202"};
List<string> target = new List<string>{"0505","0606","0707","0808","0909"};


我希望得到的结果是

01010505
01010606
01010707
01010808
01010909

02020505
02020606
02020707
02020808
02020909

我这样写的

C# code
for (int i = 0; i < one.Count; i++)
{
    for (int n = 0; n <= 4; n++)
    {
         target[n].Union(one[i]);//没有出现红线,但没有效果
         grp[n].Concat(dan[i]);//出现红线
     }
}


------解决方案--------------------
C# code

one.ForEach(o => {
    target.ForEach(t => {
        Console.WriteLine(o + t);
    });
});

------解决方案--------------------
C# code

var result = from o in one from t in target select (o+t);
foreach (var i in result) Console.WriteLine(i);
/*
01010505
01010606
01010707
01010808
01010909
02020505
02020606
02020707
02020808
02020909
*/