以下是一个程序:
using System;
class EachArray
{
public static void Main()
{
int[ ] ary=new int[10];
for (int i=0; i<10; i++) //使用for循环为数组元素赋初值
{
ary[i]=i;
}
foreach (int i in ary) //使用foreach-in语句访问(引用)数组元素
{
Console.Write("{0, 3:d }", i ); //输出数组各元素
}
}
}我不理解倒数第4行的“Console.Write("{0, 3:d }", i ); ”中的3:d是什么意思,那位指教一下
using System;
class EachArray
{
public static void Main()
{
int[ ] ary=new int[10];
for (int i=0; i<10; i++) //使用for循环为数组元素赋初值
{
ary[i]=i;
}
foreach (int i in ary) //使用foreach-in语句访问(引用)数组元素
{
Console.Write("{0, 3:d }", i ); //输出数组各元素
}
}
}我不理解倒数第4行的“Console.Write("{0, 3:d }", i ); ”中的3:d是什么意思,那位指教一下
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货