I am using a structure similar to that below. I need to loop through the 'Persons' ArrayList and set every salary to 100, whilst leaving the LastNames intact.
Structure Person
Dim LastName As String
Dim salary As Integer
End Structure
public class Test
public Shared Sub Main
Dim Persons As New ArrayList
Dim Person As New Person
With Person
.LastName = "Smith"
.salary = 50
End With
Persons.Add(Person)
With Person
.LastName = "Jones"
.salary = 20
End With
Persons.Add(Person)
With Person
.LastName = "Brown"
.salary = 80
End With
Persons.Add(Person)
End Sub
End class
I realise that a simple For Each loop won't work here. I could copy each 'Person' to a second temporary arraylist and then delete the entry in the original arraylist, but I can't figure out how to change the salary for each person and 'Add' it back again whilst keeping the 'LastName' values as they originally were.