class Writer
{
public void Write( int i )
{
}
public void Write(IList l)
{
foreach ( var i in l )
{
Console.WriteLine(i.GetType());
//Write( i );//CS1502
}
}
}
class Program
{
static void Main(string[] args)
{
int[] array1 = { 1, 2, 3 };
Writer t = new Writer();
t.Write( array1 );
}
}
打印var的类型是'System.Int32'和'System.String'。循环怎么了。任何人都可以帮助我。