泛型 错误
请求帮助:
class Program
{
public void Test(params int[]list)
{
for (int i = 0; i < list.Length; i++)
{
list[i]++;
}
foreach(int i in List) 提示这里错误
{
Console.WriteLine(i);
}
}
static void Main(string[] args)
{
int x = 1;
int y = 2;
int z = 3;
Program t = new Program();
t.Test(1, 2, 3, -1, -2, -3);
t.Test(x, y, z);
Console.WriteLine("x:{0}", x);
Console.WriteLine("y:{0}", y);
Console.WriteLine("z:{0}", z);
}
}
错误 1 使用泛型 类型“System.Collections.Generic.List<T>”需要“1”个类型参数
[此贴子已经被作者于2006-9-22 16:15:35编辑过]