我有三个ArrayLists
个string
元素,我想将它们存储到一个List
/ ArrayList
/ String Array
/ Dictionary
中。
我的意思是我想添加它们。我不知道哪一个我该怎么办?我该怎么用?
在asp.net/c#。
请帮助我!
感谢您的期待!
答案 0 :(得分:4)
只需创建一个新的ArrayList,并使用AddRange()将每个现有的ArrayList添加到它:
System.Collections.ArrayList One = { "Hello", "World" };
System.Collections.ArrayList Two = { "Second", "Array" };
System.Collections.ArrayList NewList = new System.Collections.ArrayList();
NewList.AddRange(One);
NewList.AddRange(Two);
您将拥有NewList中的所有项目
{"Hello", "World", "Second", "Array"}
答案 1 :(得分:0)
爪哇?
的java.util.HashMap: http://download.oracle.com/javase/1.4.2/docs/api/java/util/HashMap.html
答案 2 :(得分:0)
使用addAll功能