在C#中如何将Array转换为ArrayList示例
namespace ConsoleApplication2 { class Program { static void Main(string[] args) { //Create the array string[] array = { "one", "two", "three", "four", "five", "six", "seven" }; Console.WriteLine("Enter the element of the array:"); for (int i = 0; i < 7; i++) { Console.WriteLine(array[i]); } //Convert Array into ArrayList ArrayList arrLst = new ArrayList(array); Console.WriteLine("The elements in the arraylist that are copied from array:"); foreach (string s in arrLst) { Console.WriteLine(s); } } } }
在本文中,我将解释如何将数组转换为数组列表。
在C#中如何将Array转换为ArrayList?
Array类与数组有相似之处。
它存储一维元素集合。
它可以通过将数组作为参数传递给ArrayList来转换为ArrayList。
日期:2020-04-11 22:50:19 来源:oir作者:oir