-4

是否有可能在ASP、NET 1.1中有这样的东西

ArrayList list = new ArrayList();

list.Add("ccc","sss","34d");
list.Add("vvv","333","f44");
list.Add("ff","6yh","sdsd");
4

5 回答 5

6

尝试list.Add(new string[]{"ccc", "sss", "34d"});

于 2012-09-06T11:21:03.727 回答
0

不,你需要某种物体来固定你的三个琴弦。

public class MyHolder{
   public string A;
   public string B;
   public string C;

   public MyHolder (string a, string b, string c) { 
       A = a; 
       B = b; 
       C = c; 
   }
}


...

list.Add(new MyHolder("ccc","sss","34d"));
于 2012-09-06T11:20:26.413 回答
0

您拥有的最好的是 AddRange 方法,它接受任何实现 ICollection 接口的对象 http://msdn.microsoft.com/en-us/library/system.collections.arraylist.addrange(v=vs.71).aspx

于 2012-09-06T11:21:07.990 回答
0

你想要的可能是List<string>

List<string> myFirstList = new List<string>();
myFirstList.add("My first string");
myFirstList.add("My second string");

List<string> mySecondList = new List<string>();
mySecondList.add("My third string");
mySecondList.add("My fourth string");

// Add all contents of first list to second:
mySecondList.addRange(myFirstList);

参考:MSDN:列表类

于 2012-09-06T11:22:28.987 回答
0

您也可以像这样添加:

list.Add("ccc," + "sss," + "34d");

添加后,您可以使用拆分功能拆分每个项目,例如: split(',')

于 2012-09-06T11:58:57.763 回答