LinkedList<T>.Contains(T) method is used to check whether a value is in the LinkedList<T> or not.
public bool Contains (T value);
Here, value is the value to locate in the LinkedList<T>. The value can be null for reference types.
Return Value: This method returns True if value is found in the LinkedList, otherwise, False.
Below given are some examples to understand the implementation in a better way:
Note: This method performs a linear search. Therefore, this method is an O(n) operation, where n is Count.
- How to set a Check Box in the DateTimePicker in C#?
- C# | Check if SortedDictionary contains the specified key or not
- C# | Check if Num Lock is on or off through Console
- How to check whether a thread is alive or not in C#
- C# | Check if the Hashtable contains a specific Key
- C# | Check if the Hashtable contains a specific Value
- C# | Check if a Stack contains an element
- C# | Check if an array is read-only or not
- C# | Check if the specified string is in the StringCollection
- Check if two enums are equal or not in C#
- C# | Check if the ArrayList is read-only
- C# | Check if the StringCollection is read-only
- C# | Check the HybridDictionary for a specific key
- C# | Check if two String objects have the same value | Set-1
- C# | Check if the BitArray is read-only
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.