KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an array in c# that is 1-based (generated from a call to get_Value for an Excel Range I get a 2D array for example object[,] ExcelData = (object[,]) MySheet.UsedRange.get_Value(Excel.XlRangeValueDataType.xlRangeValueDefault); this appears as an array for example ExcelData[1..20,1..5] is there any way to tell the compiler to rebase this so that I do not need to add 1 to loop counters the whole time? List<string> RowHeadings = new List<string>(); string [,] Results = new string[MaxRows, 1] for (int Row = 0; Row < MaxRows; Row++) { if (ExcelData[Row+1, 1] != null) RowHeadings.Add(ExcelData[Row+1, 1]); ... ... Results[Row, 0] = ExcelData[Row+1, 1]; & other stuff in here that requires a 0-based Row } It makes things less readable since when creating an array for writing the array will be zero based.
Tags (comma-separated)
Save Edits
Cancel