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
- How to set a Check Box in the DateTimePicker in C#?
- C# | Check if a HashSet contains the specified element
- C# | Check if an element is in the Queue
- How to check whether a thread is alive or not in C#
- C# | Check if a SortedList is read-only
- C# | Check if the ArrayList is read-only
- C# | Check if a Stack contains an element
- C# | Check if the Hashtable contains a specific Key
- C# | Check if the Hashtable contains a specific Value
- C# | Check if two String objects have the same value | Set-1
- C# | Check if HybridDictionary is read only
- C# | Check if ListDictionary contains a specific key
- C# | Check if an element is in the Collection<T>
- C# | Check if an array is read-only or not
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.