METHOD

List<T>.Contains

Tests membership using the default equality comparer; does not add an element.

Formal Syntax & Structure

csharp syntaxcsharp
bool Contains(T item)

Working Example

Example Snippetcsharp
var ids = new System.Collections.Generic.List<int> { 4 };System.Console.WriteLine(ids.Contains(4));
C# & .NET Reference