Contains
MethodΒΆ
Determines if an element is contained in the List. Returns a bool
value.
listName.Contains(element);
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | List<string> planets = new List<string>()
{
"Mercury",
"Venus",
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune"
};
bool plutoCheck = planets.Contains("Pluto");
Console.WriteLine(plutoCheck);
|
Output
False