c5-04.cs
来自「一本很好的教材.C#开发者必备.内容全面,很难得哦.」· CS 代码 · 共 23 行
CS
23 行
//使用数组的示例
using System;
class DeclareArraysSample
{
public static void Main()
{
// 一维数组
int[] numbers = new int[5];
// 多维数组
string[,] names = new string[5,4];
// 交错数组
byte[][] scores = new byte[5][];
for (int i = 0; i < scores.Length; i++)
{
scores[i] = new byte[i+3];
}
// 打印每行长度
for (int i = 0; i < scores.Length; i++)
{
Console.WriteLine("第{0}行的长度为{1}!", i, scores[i].Length);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?