Answer the question
In order to leave comments, you need to log in
How to calculate to what value the array is filled for each of the dimensions?
Hello.
There is some two-dimensional array, for example: string[,] dataArray = new string[10, 10];
And this array is filled with some string values, but not completely, but only up to some values. For example, by dimension (dimension) - 0 to 4, and by dimension (dimension) - 1 to 5.
How to calculate to what value the array is filled for each of the dimensions?
PS Familiar with the method:
.GetUpperBound(0)
.GetUpperBound(1)
Answer the question
In order to leave comments, you need to log in
Go through the array and check what is filled there. There are two options here, run from the beginning and look for the first empty one or run from the end and look for the first filled one. choose your own strategy.
There is also the question of how the recording goes - randomly, in any cell, so to speak, or sequentially.
If randomly, then most likely you need to take the viewing option from the end. If sequentially, then it is generally possible to do without a bypass, remembering the maximum index (s) on which (th) the record was made.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question