Is there a simple way to remove Objects from a List by using a specified value?
I add 2 persons to a List, how can now I remove a person by a name without using any Loops? (if possible)
Public Class Form1
Public Persons As New List(Of Person)
Private Sub Test()
Persons.Add(New Person With {.Name = "Jamie", .Age = 99})
Persons.Add(New Person With {.Name = "Adam", .Age = 40})
'How to remove a person from the list having the name "Jamie" ?
'Persons.Remove(Name = "Jamie")... ???
End Sub
End Class
Public Class Person
Public Name As String
Public Age As Integer
End Class
in VB:
(Thanks Heinzi)