java的童鞋。。。别这样~~~- using System;
- using System.Collections.Generic;
- namespace Que
- {
- class Program
- {
- static void Main(string[] args)
- { //把List<int>中的元素放到数组中去
- List<int> list1 = new List<int>();
- list1.Add(1);
- list1.Add(2);
- //...
- int[] iArray1 = new int[list1.Count];
- for(int i = 0;i<list1.Count;i++)
- {
- iArray1[i] = list1[i];
- }
- foreach(int i in iArray1)
- {
- Console.WriteLine(i);
- }
- Console.ReadKey();
- }
- }
- }
复制代码 |