启动多维数组索引

时间:2014-09-15 13:53:54

标签: c# arrays

我有一个返回Multidimensional Array的方法。当我展开并看到数据从索引[1,1]开始时如何用C#完成?

没有[0,0],[0,1] ......

开始
[1,1]
[1,2]
[1,3]

...

当我初始化时,例如object[,] = new object[5,5]; 数据从索引[0,0].

开始

这是整个代码

Worksheet cSheet = (Worksheet)workBookE.Worksheets[i];
Range range = cSheet.UsedRange;
string address = range.get_Address();
string[] cells = address.Split(new char[] { ':' });
string beginCell = cells[0].Replace("$", "");
string endCell = cells[1].Replace("$", "");
object[,] objectArray = (object[,])cSheet.get_Range(beginCell + ":" + endCell).Value2; // here the index starts from 1,1

0 个答案:

没有答案