当前位置:网站首页>Série de démarrage C # (XI) - - tableaux multidimensionnels
Série de démarrage C # (XI) - - tableaux multidimensionnels
2022-06-11 10:24:00 【InfoQ】
int[,] arr = new int[,]{{1,2,3},{4,5,6},{7,8,9}};int[,] arr = {{1,2,3},{4,5,6},{7,8,9}};class Program{
static void Main(string[] args){
int[,] arr = new int[,] { { 1, 2 }, { 3, 4 } };
// Traverser les lignes
for (int i = 0; i < arr.GetLength(0); i++)
{
// Traverser les colonnes
for (int j = 0; j < arr.GetLength(1); j++)
{
Console.WriteLine(arr[i,j]);
}
}
// foreachTraversée
foreach (var item in arr)
{
Console.WriteLine(item);
}
Console.ReadLine();
}
}int[][]Arr = new int[3][];Arr[0] = new int[] { 1, 2, 3 };Arr[1] = new int[] { 4, 5, 6, 7 };Arr[2] = new int[] { 8, 8 };class Program{
static void Main(string[] args){
int[][]Arr = new int[3][];
Arr[0] = new int[] { 1, 2, 3 };
Arr[1] = new int[] { 4, 5, 6, 7 };
Arr[2] = new int[] { 8, 8 };
// Prendre la longueur de la dimension
for (int i = 0; i < Arr.GetLength(0); i++)
{
// Attention, c'est Arr[i].GetLength(0),
for (int j = 0; j < Arr[i].GetLength(0); j++)
{
Console.WriteLine(Arr[i][j]);
}
}
// foreachTraversée
foreach (var item in Arr)
{
Console.WriteLine(item);
// ProduitsSystem.Int32[], Aucune valeur spécifique n'a été trouvée
}
Console.ReadLine();
}
}
边栏推荐
- MySQL permission management and backup
- Cadence OrCAD capture design method to avoid misoperation graphic tutorial
- What are the ABAP keywords and syntax that cannot be used in the ABAP cloud environment?
- NGUI,选择性别男女
- 详述用网络分析仪测量DC-DC和PDN
- 接口调优的大致思路
- Xilinx pin constraint file xdc
- 知识点滴 - 性格分析-四类法
- [torch]: parallel training and can dynamically set the batch size of the first GPU
- General idea of interface tuning
猜你喜欢

Mysql--索引

Explain the physical layer consistency test of 2.5g/5g/10g Base-T Ethernet interface in detail!

Reprint: linearlayout+fragment to achieve the lower navigation bar effect

How much do you know about software compatibility testing? How to select a software compatibility testing organization?

Technology cloud report: privacy computing under the wave of Web3.0

Q1 revenue exceeded expectations. Why did man Bang win headwind growth?

Cisp-pte XSS Foundation

Picture rule page turning

吴恩达机器学习课程-第七周

Detail measurement of DC-DC and PDN with network analyzer
随机推荐
How much do you know about the functions and functions of Rexroth solenoid directional valve
手写代码call,apply,bind
iPhone 15 被迫用上 Type-C 接口
Record yesterday's embarrassment
面试复习手写题--函数截流与抖动
How much do you know about software compatibility testing? How to select a software compatibility testing organization?
Practical process of selecting DC-DC switching power supply controller
NGUI,冷却效果
DOtween使用方法
New feature of ES6 - arrow function
Empire CMS imitates DIY handmade website source code of craft activity /92kaifa imitates self-adaptive mobile phone version template of craft activity
Introduction to ZigBee module wireless transmission star topology networking structure
【高并发】关于线程池,蚂蚁金服面试官问了我这些内容!!
Cisp-pte XSS Foundation
What are the functions and applications of Mogg test controller
MySQL基础篇常用约束总结下篇
【K-Means】K-Means学习实例
Preview component packaging graphic tutorial in cadence OrCAD capture schematic design interface
RSA signature issues
MySQL basic learning notes 03