C# Equivalent to VB ReDim Preserve
Resizing arrays while preserving the existing contents is easily done in VB using ReDim Preserve. In C#, you have other alternatives:
VB:
Dim YourArray() As Integer
...
ReDim Preserve YourArray(i)
C#:
int[] YourArray;
...
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.