Horje

CHECK if item exists in a list - Lists - Visual Basic .NET
Learn
Visual Basic .NET - Lists - Check if item exists in a list
Check if item exists in a List

   Sub Main()
        Dim People = New List(Of String)({"Bob Barker", "Ricky Bobby", "Jeff Bridges"})
        Console.WriteLine(People.Contains("Rick James"))
        Console.WriteLine(People.Contains("Ricky Bobby"))
        Console.WriteLine(People.Contains("Barker"))
        Console.Read 
    End Sub

Produces the following output:

False
True
False

Syntax

  • List.Add(item As Type)
  • List.RemoveRange(index As Integer, count As Integer)
  • List.Remove(index As Integer)
  • List.AddRange(collection)
  • List.Find(match as Predicate(of String))
  • List.Insert(index as Integer , item as Type)
  • List.Contains(item as Type)
Read Article
https://develop.horje.com/learn/1434/reference