zoukankan      html  css  js  c++  java
  • c# 第四课 Arrays

    Initializing Array Elements
        int[] myIntArray = new int[5] { 2, 4, 6, 8, 10 }; // longer syntax
        int[] myIntArray = { 2, 4, 6, 8, 10 };                      // shorter syntax

    定义2行3列的int 类型的数组

    int [ , ] myRectangularArray = new int[2,3];

    The params  keyword allows you to pass in a variable number of parameters without necessarily explicitly creating the array.
     

    初始化4行3列的int 类型的数组

               

    const int rows = 4;    const int columns = 3;
    
                // imply a 4x3 array
    
                int[,] rectangularArray =
    
               {
    
                        {0,1,2}, {3,4,5}, {6,7,8}, {9,10,11}
    
               };
    
                for (int i = 0; i < rows; i++)
    
                {
    
                    for (int j = 0; j < columns; j++)
    
                    {
    
                        Console.WriteLine("rectangularArray[{0},{1}] = {2}",
    
                            i, j, rectangularArray[i, j]);
    
                    }
    
                }
    
     
  • 相关阅读:
    openssh的服务端配置文件
    SSH的端口转发
    ssh服务
    文件引入
    数据类型的转换
    作用域
    静态变量
    函数
    php嵌入html的解析过程
    PHP执行过程
  • 原文地址:https://www.cnblogs.com/GSONG/p/4399076.html
Copyright © 2011-2022 走看看