CS1503: 无法从“int[]”转换为“object[]”
class Bar
{
static void Main()
{
Foo(new string[]{"Hello", "world"}); // okay
Foo(new object[]{1, 2, 3}); // okay
Foo(new int[]{1, 2, 3}); // error
}
static void Foo(object[]oo)
{
}
}
为什么会这样:
a.cs(7,5 ): error CS1502: 与“Bar.Foo(object[])”最匹配的重载方法具有一些无效参数
a.cs(7,18): error CS1503: 参数“1” : 无法从“int[]”转换为“object[]”
难道int不是object吗, 我要怎样才能把int[]转换为object[]?