List<string> monthTemp = new List<string>();我想要创建 二维的 的 该如何创建?

解决方案 »

  1.   

    你想象的“二维”是什么定义?List<List<string>>?
      

  2.   


    List<string[]> list = new List<string[]>();
      

  3.   


     List<List<string>> list = new List<List<string>>();都能实现二维
      

  4.   

    dictionary<key,value> _dic=new dictionary<key,value>();
      

  5.   

    List<List<string>> list = new List<List<string>>();
    list[外层索引][内层索引]
      

  6.   

    楼主的思想很活跃但一般不只用一个LIST,多维就多个LIST。4楼的说得很对
      

  7.   


                List<String[]> list = new List<String[]>();            String [] strArr1 = new String[] { "one","two","three"};
                list.Add(strArr1);
                String[] strArr2 = new String[] { "A", "B", "C", "D" };
                list.Add(strArr2);            for (Int32 i = 0; i < list.Count; i++)
                {
                    for (Int32 j = 0; j < list[i].Length; j++)
                    {
                        Console.WriteLine(list[i][j]);
                    }
                }
      

  8.   


     List<List<string>> list = new List<List<string>>();
                List<string> stringList1 = new List<string>();
                List<string> stringList2 = new List<string>();
               
                stringList1.Add("a");
                stringList1.Add("b");
                stringList1.Add("c");
                list.Add(stringList1);            stringList2.Add("e");
                stringList2.Add("f");
                stringList2.Add("g");
                list.Add(stringList2);            foreach (List<string> strl in list)
                {
                    foreach (string s in strl)
                    {
                        Console.Write(s + "  ");
                    }
                    Console.WriteLine();
                }
                Console.ReadKey();
      

  9.   

                List<List<String>> list = new List<List<String>>();            List<String> subList1 = new List<String>();
                List<String> subList2 = new List<String>();
                subList1.Add("One");
                subList1.Add("Two");
                subList1.Add("Three");            subList2.Add("A");
                subList2.Add("B");
                subList2.Add("C");
                subList2.Add("D");            list.Add(subList1);
                list.Add(subList2);            for (Int32 i = 0; i < list.Count; i++)
                {
                    for (Int32 j = 0; j < list[i].Count; j++)
                    {
                        Console.WriteLine(list[i][j]);
                    }
                }