/Array.CreateInstance创建类型为int,长度为5的数组
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Array intArray = Array.CreateInstance(typeof(int), 5);//Array.CreateInstance创建类型为int,长度为5的数组
for (int i = 0; i < 5; i++) {
intArray.SetValue(15, i);//像数组intArray[i]赋值
}
for (int i = 0; i < 5; i++) {
Console.WriteLine(intArray.GetValue(i));//获取元素intArray[i]的值并输出
}
Console.ReadLine();
}
}
}