Converting ReDim Preserve on an array property throws
CS0206: A property or indexer may not be passed as an out or ref parameter
while Array.Resize is converted correctly by utilizing a local variable for this case.
VB.Net input code
Public Class TestClass
Public Property NumArray1 As Integer()
Public Sub New()
Array.Resize(NumArray1, 3)
ReDim Preserve NumArray1(4)
End Sub
End Class
Erroneous output
using System;
public partial class TestClass
{
public int[] NumArray1 { get; set; }
public TestClass()
{
var argarray = NumArray1;
Array.Resize(ref argarray, 3);
NumArray1 = argarray;
Array.Resize(ref this.NumArray1, 5);
}
Expected output
using System;
public partial class TestClass
{
public int[] NumArray1 { get; set; }
public TestClass()
{
var argarr = NumArray1;
Array.Resize(ref argarr, 3);
NumArray1 = argarr;
var argarr1 = NumArray1;
Array.Resize(ref argarr1, 5);
NumArray1 = argarr1;
}
}
Converting ReDim Preserve on an array property throws
CS0206: A property or indexer may not be passed as an out or ref parameter
while Array.Resize is converted correctly by utilizing a local variable for this case.VB.Net input code
Erroneous output
Expected output
Details