Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB Equivalent of "To" in C#

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?

like image 800
Logan B. Lehman Avatar asked Dec 10 '25 23:12

Logan B. Lehman


1 Answers

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.

like image 185
p.s.w.g Avatar answered Dec 12 '25 11:12

p.s.w.g



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!