Can anyone please tell what does the two functions do? They take an integer argument which is told to be dimension. But how does the value of this integer changes the output?
Can anyone please tell what does the two functions do?
It is written in their MSDN pages. They gets the index of the first / last element of the specified dimension in the array. Take a look Array.GetUpperBound and Array.GetLowerBound
They take an integer argument which is told to be dimension.
Yes, as Patashu mentioned, arrays can have multidimension.
Any idea why GetLowerBound() is always returning 0? If this always returns 0 then why do we need to call this method?
In an array, every dimension can have their specific lower and uppor bounds. So, this methods can create different results for each dimension of array.
Note that, although most arrays in the .NET Framework are zero-based (that is, the
GetLowerBound
method returns zero for each dimension of an array), the .NET Framework does support arrays that are not zero-based. Such arrays can be created with the CreateInstance(Type, Int32\[\], Int32\[\]) method, and can also be returned from unmanaged code.
Check out;