问答详情
源自:5-1 C#的声明数组和赋值

教程打印语句太旧了?

教程中Console.WriteLine("四名同学的年龄是:{0}、{1}、{2}、{3}",age[ ],age[ ],age[ ],age[ ]);

和 Console.WriteLine("四位同学的年龄是" + age[0] + " " + age[1] + " " + age[2] + " " + age[3]); 有什么不同?


然而,把Console.WriteLine("四名同学的年龄是:{0}、{1}、{2}、{3}",age[ ],age[ ],age[ ],age[ ]);拿去vs 2013 试了一下,识别成语法错误了,所以也许这是旧的打印方法?

提问者:广藿香Patchouli 2015-10-10 23:29

个回答

  • 一毛钱
    2015-11-30 11:33:48

    是你写错了,没有写下标

    Console.WriteLine("四名同学的年龄是:{0}、{1}、{2}、{3}",age[0],age[1],age[2],age[3]);