关于c#数组输出的问题

来源:百度知道 编辑:UC知道 时间:2024/07/04 17:50:41
我看到别人的一个程序,大意是:int[] arr; ...(中间是附值的,省略了)...
console.write[arr]最后他把数组中的所有数据都输出了,可是他为什么没用for循环输入啊 为什么我用 console.write[arr]就输不出来数组啊~~~~

看仔细了,是不是代码里转为字符串输出了

格式化参数应该是

连个话都说不清楚.指望别人怎么给你回答.
前面和后面有不一样吗??????

static void Main(string[] args)
{
int[] a = { 1, 2, 3, 4 };
foreach (int temp in a)
Console.Write(temp + " ");
}

他是不是这样输出?
为什么没用for循环输入?我都晕了
还是说是下面这样?

static void Main(string[] args)
{
int[] a = new int[3];
foreach (int temp in a)
Console.Write(temp + " ");
}

你看看他是不是用的foreach
或则是在其他类,或方法里面循环出来的,

他是不是用了foreach来输出数组?