正确的过载选择

Tos*_*shi 5 c#

我有代码

//this runs 
string[] s_items = {"0","0"};
string s_output = string.Format("{0}{1}",s_items);

//this one throws a exception
int[] i_items = {0,0};          
string i_output = string.Format("{0}{1}",i_items);
Run Code Online (Sandbox Code Playgroud)

为什么第一个运行而第二个抛出异常?为何选择

int[]在Format(String,?Object)过载

string[]在Format(String,?Object[])过载

Dam*_*ver 7

A string[]可以转换为a,object[]因为它们都是引用类型的数组.所有参考文献都是"平等的".这是从第1天开始构建到C#语言中的令人讨厌的(数组)转换之一,并且不应该存在,但是从第1天开始我们就没有泛型和适当的协变/反向变换规则.

一个int[]无法转换为object[]因为ints,实际包含在第一个数组中的东西不是引用.