什么是交错数组? [英] What is a jagged array?

查看:256
本文介绍了什么是交错数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是交错数组(在C#)?任何例子,当一个人应该使用它......

What is a jagged array (in c#)? Any examples and when should one use it....

推荐答案

一个交错数组是数组的数组。

A jagged array is an array of arrays.

string[][] arrays = new string[5][];

这是五个不同的串阵列的集合,每个可以是不同的长度(它们也可以是相同的长度,但问题是没有的保证的,他们是)。

That's a collection of five different string arrays, each could be a different length (they could also be the same length, but the point is there is no guarantee that they are).

arrays[0] = new string[5];
arrays[1] = new string[100];
...

这是从一个二维阵列,其中它的矩形,这意味着每行具有相同的列数不同。

This is different from a 2D array where it is rectangular, meaning each row has the same number of columns.

string[,] array = new string[3,5];

这篇关于什么是交错数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆