Tangible Software Solutions
The Most Trusted Name in Source Code Conversion
Resizing arrays while preserving the existing contents is easily done in VB using ReDim Preserve. In C#, you have other alternatives:
Dim YourArray() As Integer
ReDim Preserve YourArray(i)
C# – 2005 and beyond:
Array.Resize(ref YourArray, i + 1);
C# – prior to 2005:
int temp = new int[i + 1];
if (YourArray != null)
Array.Copy(YourArray, temp, Math.Min(YourArray.Length, temp.Length));
YourArray = temp;
If you need to convert between VB and C# and you are depending on the results being reliable and accurate, then you will want to have Instant C#, the best VB to C# converter, or Instant VB, the best C# to VB converter, at your fingertips.
Copyright © 1997 - 2017 Tangible Software Solutions Inc.