我有一个返回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