List<string> one = new List<string>{"0101","0202"};
List<string> target = new List<string>{"0505","0606","0707","0808","0909"};我希望得到的结果是01010505
01010606
01010707
01010808
0101090902020505
02020606
02020707
02020808
02020909我这样写的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]);//出现红线
     }
}

解决方案 »

  1.   

    List<string> one = new List<string> { "0101", "0202" };
    List<string> target = new List<string> { "0505", "0606", "0707", "0808", "0909" };
    foreach (string s in one)
    foreach (string t in target)
    Console.WriteLine(s + t);
      

  2.   


    List<string> one = new List<string> { "0101", "0202" };
                List<string> target = new List<string> { "0505", "0606", "0707", "0808", "0909" };            for (int i = 0; i < one.Count; i++)
                {
                    for (int n = 0; n < target.Count; n++)
                    {
                        Console.WriteLine(one[i] + target[n]);
                    }
                }什么红线?
      

  3.   

    for (int i = 0; i < one.Count; i++)
    {
        for (int n = 0; n <= 4; n++)
        {
            Console.WriteLine(one[i] + target[n]);
         }
    }
      

  4.   

    List<string> one = new List<string>{"0101","0202",”0303","0404"};
    List<string> target = new List<string>{"0505","0606","0707","0808","0909",
                                           "1515","1616","1717","1818","1919",
                                           "2525","2626","2727","2828","2929",
                                           "3535","3636","3737","3838","3939"};0505~0909与0101拼接
    1515~1919与0202拼接
    2525~2929与0303拼接
    3535~3939与0404拼接
      

  5.   


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

  6.   


    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
    */