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.
- C# | Check if SortedDictionary contains the specified key or not
- C# | Check the HybridDictionary for a specific key
- C# | Check if the StringCollection is read-only
- C# | Check if an array is read-only or not
- How to check whether a thread is alive or not in C#
- C# | Check if Hashtable is read-only
- C# | Check if two String objects have the same value | Set-1
- C# | Check whether a Hashtable contains a specific key or not
- C# | Check if the ArrayList is read-only
- Check if two enums are equal or not in C#
- C# | Check if the BitArray is read-only
- C# | Check if an element is in the Collection<T>
- C# | Check if ListDictionary contains a specific key
- C# | Check if an element is in the Queue
- C# | Check if a HashSet contains the specified element
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.