檢查列表中是否存在專案
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
產生以下輸出:
False
True
False