I am running into an issue with Array resizing in vb.net. I sort of understand why the issue is coming up but I'm not sure how to get around it. Basically, I have a class that has an array of objects being passed to it. I'm trying to have a sub resize the array and add another object to it. However, once it's done, the original object does not get updated.
Optimally I would like something like this.
Sub Main()
Dim parent As New Parent
Dim first As New Child()
Dim second As New Child()
Dim children As Child() = New Child() {first, second}
parent.children = children
setChildren(getChildren(parent))
End Sub
Private Function getChildren(parent As Parent) As Child()
Return parent.children
End Function
Private Sub setChildren(ByRef testArray As Child())
testArray = New Child(3) {}
End Sub