基础打的不牢哎。。。竟然把数组声明忘了

来源:互联网 发布:风雅软件 编辑:程序博客网 时间:2024/05/01 20:39

    今天在看书,里面提到了数组(What arrays are, and how to use them),一想:好像数组自己不会用了。很汗颜!  

    于是乎:VS打开,建了个WINFORM项目,练习ING!

    

  1.  static void Main(string[] args)
  2.         {
  3.             //int[] myInt = {1,2,3,4,5 };
  4.             int[] myInt = new int[4];
  5.             myInt[0] = 0;
  6.             myInt[1] = 1;
  7.             myInt[2] = 2;
  8.             myInt[3] = 3;
  9.             foreach (int i in myInt)
  10.             {
  11.                 Console.WriteLine("The number is: {0}/n", i);
  12.                
  13.             }
  14.             Console.ReadLine();
  15.         }
原创粉丝点击