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 if HybridDictionary is read only
- C# | Check if the StringDictionary contains a specific key
- C# | Check if ListDictionary is read-only
- C# | Check if ListDictionary contains a specific key
- C# | Check the HybridDictionary for a specific key
- C# | How to check whether a List contains a specified element
- C# | Check if the BitArray is read-only
- C# | Check if the StringDictionary contains a specific value
- C# | Check if an element is in the Collection<T>
- C# | Check if Num Lock is on or off through Console
- C# | Check if the ArrayList is read-only
- C# | Check if the Hashtable contains a specific Key
- C# | Check if the specified string is in the StringCollection
- C# | Check if an element is in the Queue
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.