Question

I know that in the context of loops the equivalent of To in i = long1 To long2 in VB is (i = long1; i < long2; ++i) in C#, but I am trying to find a an equivalent of it in the context of ReDim/System.Array.Resize():

VB6:

ReDim indexCorr(LBound(fDefMatchs) to UBound(fDefMatchs)

C#:

System.Array.Resize(indexCorr, ***?)

Does anyone else know how to resize an array in C# using a range of numbers like this?

Was it helpful?

Solution

I think what you're looking for is this:

System.Array.Resize(ref indexCorr, fDefMatchs.Length);

However, in .NET you cannot set the lower bound of an array. From the documentation:

Arrays are zero indexed: an array with n elements is indexed from 0 to n-1.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top