当前位置:网站首页>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();
}
}
边栏推荐
- Practical process of selecting DC-DC switching power supply controller
- Correct opening method of RPC | understand go native net/rpc package
- Record yesterday's embarrassment
- Waiting event enq: Ko - some feasible processing methods for fast object checkpoint
- Wuenda machine learning course - week 7
- puppeteer入门之 Browser 类
- [high concurrency] the interviewer of ant financial asked me about thread pool!!
- [Objective-C] differences between structs and classes
- 手写代码call,apply,bind
- 【MYSQL】存储过程的使用
猜你喜欢

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

Datagrip 2022, datagrip function

電子設備輻射EMC整改案例

金仓数据库KingbaseES中的sys_checksums坏块检测功能

Wechat applet ordering system with source code

Internet of things security in the era of remote work

Windows 安装MySQL5.7 以上的版本(压缩包形式安装)

转载:LinearLayout+Fragment实现下导航栏效果

电子设备辐射EMC整改案例
![[machine learning theory] true positive, true negative, false positive, false negative concept](/img/59/8264d6cbd96480b59e5b8ff96320be.png)
[machine learning theory] true positive, true negative, false positive, false negative concept
随机推荐
TikTok在英国遭遇文化冲突,短期内众多员工离职
宝塔面板备份与恢复数据
[audio and video] Introduction to SEI
minIni移植到littlefs
[Objective-C] differences between structs and classes
Batch add noise to data and generate new named annotation files
Dotween usage
UGUI鼠标点击扩散UI效果
Differences between beanfactory and factorybean
详解2.5G/5G/10G Base-T以太网接口物理层一致性测试!
Streaming computing knowledge
Cadence OrCAD capture design method to avoid misoperation graphic tutorial
Common techniques for handling dates
[high concurrency] the interviewer of ant financial asked me about thread pool!!
C语言课程设计
动态渲染数据和轮播图
鼠标点击坐标转换生成
Xilinx pin constraint file xdc
rpc的正确打开方式|读懂Go原生net/rpc包
MySQL基础篇常用约束总结上篇