这个程序哪里错了??谢谢。
using System;
namespace UCOM.HR{
public class P76A{
public static int Main(){
int[] MyArray=new int[4];
MyArray[0]=1;
MyArray[1]=2;
MyArray[2]=3;
MyArray[3]=4;
for(int i=0;i<4;i++){
Console.WriteLine("MyArray[{0}] is {1} ",i,MyArray[i]);
}
Console.WriteLine("MyArray's length is {2} .",MyArray.Length);
Console.WriteLine("MyArray first[]'s length is {3} .",MyArray.GetLength(0));
return 1;
}
}
}
*******************************
MyArray[0] is 1
MyArray[1] is 2
MyArray[2] is 3
MyArray[3] is 4
未处理的异常: System.FormatException: 索引(从零开始)必须大于或等于零,且小于参
数列表的大小。
at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String fo
rmat, Object[] args)
at System.String.Format(IFormatProvider provider, String format, Object[] arg
s)
at System.IO.TextWriter.WriteLine(String format, Object arg0)
at System.IO.SyncTextWriter.WriteLine(String format, Object arg0)
at UCOM.HR.P76A.Main() in f:\net\jtgj\P76A.cs:line 15