是否有可能在ASP、NET 1.1中有这样的东西
ArrayList list = new ArrayList();
list.Add("ccc","sss","34d");
list.Add("vvv","333","f44");
list.Add("ff","6yh","sdsd");
尝试list.Add(new string[]{"ccc", "sss", "34d"});
不,你需要某种物体来固定你的三个琴弦。
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"));
您拥有的最好的是 AddRange 方法,它接受任何实现 ICollection 接口的对象 http://msdn.microsoft.com/en-us/library/system.collections.arraylist.addrange(v=vs.71).aspx
你想要的可能是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:列表类
您也可以像这样添加:
list.Add("ccc," + "sss," + "34d");
添加后,您可以使用拆分功能拆分每个项目,例如: split(',')