Reputation: 163
I need to remove an item form a generic list, which is actually a list of of another class, in VB.net ?
Below is my class, how to achieve the following?
Public Class Settings
Public Property Sections As List(Of Section)
End Class
Public Class Section
Public Property Name As String
Public Property Age As Int
Public Property addesss As String
End Class
Upvotes: 0
Views: 231
Reputation: 54417
The RemoveAll
method allows you to find items that match specific criteria and remove them:
mySettings.Sections.RemoveAll(Function(s) s.Name = "Three")
The argument is a lambda expression that matches Section
objects with a Name
property equal to "Three".
Upvotes: 2