Browse by Topic

Popular

Latest

Latest Posts

Illustration of a C# List with a magnifying glass checking for an element, representing existence checks.
C#

C# List Exists: How to Check for Elements

Learn how to check whether an item exists in a C# List using Contains, Exists, and LINQ Any, including equality and performance behavior.

C#ListLINQContains
Illustration of a C# list with an index pointer highlighting a matching element using FindIndex.
C#

C# List FindIndex: Locating Elements by Predicate

Learn how to use `List<T>.FindIndex` in C# to locate the first element matching a predicate, handle `-1` when nothing matches, and choose among `FindIndex`, `IndexOf`, and LINQ.

C#List<T>FindIndexPredicate
Illustration of a C# list being filtered by a predicate, showing matching items selected into a new list.
C#

Using C# List FindAll to Filter Collections

Learn how to filter a List<T> with FindAll and Predicate<T> in C#, including syntax, examples, and how it compares with LINQ Where.

C#List<T>PredicateFiltering
Illustration of searching a C# list with a predicate to find a matching element.
C#

C# List Find: Using Predicates to Locate Elements

Learn how to use C# List<T>.Find with predicates, handle missing elements, and decide when to prefer LINQ alternatives.

C#List<T>PredicateLINQ
Illustration of a C# List with an index pointer highlighting the position of a found element.
C#

C# List IndexOf: Locating Elements in a List

Learn how to use List.IndexOf in C# to find element positions, handle missing items, and choose between IndexOf and FindIndex.

C#List<T>IndexOfCollections
Illustration of a magnifying glass inspecting items in a C# list collection, with one item highlighted to represent a match found by the Contains method.
C#

C# List Contains: Checking for Elements in a List

Learn how List<T>.Contains works in C#, how equality is determined for value and reference types, and when HashSet is more efficient for membership checks.

List<T>ContainsEqualityHashSet
Illustration of a C# List being cleared, showing an empty container after the Clear method is called.
C#

C# List Clear: How to Empty a List in C#

c# list clear: Learn how to use List<T>.Clear() to remove all elements from a C# list, including performance implications, alternatives, and common pitfalls.

List<T>Clear methodC# collectionsmemory management
Illustration of a C# List being filtered by a predicate using RemoveAll.
C#

Using List.RemoveAll in C# to Filter Elements

Learn how to use List<T>.RemoveAll in C# with predicates, including runtime behavior, performance tradeoffs, and alternatives.

C#List<T>RemoveAllPredicate
Illustration of a C# List with an element being removed at a specific index, showing the shifting of subsequent elements.
C#

C# List RemoveAt: Removing Elements by Index

Learn how List<T>.RemoveAt works in C#, including its performance characteristics, common pitfalls, and when to use alternatives.

C#List<T>RemoveAtCollections
Illustration of removing an element from a C# List, showing the remaining elements shifting left to fill the gap.
C#

C# List Remove: Methods and Performance

Remove elements from a C# List<T> using Remove, RemoveAt, RemoveAll, and RemoveRange, with examples, performance tradeoffs, and common pitfalls.

C#List<T>RemoveRemoveAll