Pages

Topics

Tools

↑↓navigate↵openescclose

C# guides

Every published C# guide, newest first, with practical examples you can copy into your own project.

3,965 guides across 14 topics

Topics

Latest C# guides

Illustration of a C# queue with items entering and leaving in FIFO order, showing enqueue and dequeue operations.
C#

C# Queue Usage: FIFO Data Structure with Examples

Learn how to use Queue<T> in C# for FIFO processing, including Enqueue, Dequeue, Peek, thread safety, and producer-consumer patterns.

Queue<T>C# CollectionsThread SafetyProducer-Consumer
A visual representation of a HashSet with a custom equality comparer, showing two distinct objects being treated as equal.
C#

C# HashSet Equality Comparer: Custom Equality

c# hashset equality comparer: Learn how to control HashSet<T> equality checks with IEqualityComparer<T> in C#. See practical examples for case-insensitive and custom o...

C#HashSetIEqualityComparerCustom Comparer
Side-by-side comparison of a List and a HashSet in C#, showing ordered versus unordered storage and fast lookup
C#

C# List vs HashSet: Choosing the Right Collection

Compare C# List and HashSet for ordering, duplicates, and lookup performance. Learn which collection fits your scenario with code examples.

C# CollectionsHashSetListPerformance
Illustration of a HashSet losing elements that overlap with another collection, representing the ExceptWith operation.
C#

C# HashSet ExceptWith: Remove Elements In Place

c# hashset exceptwith: Learn how to use HashSet.ExceptWith to remove elements in place, compare it with LINQ Except, and understand performance implications.

HashSetC# CollectionsSet OperationsLINQ
Diagram showing two overlapping sets with the intersection highlighted, representing C# HashSet IntersectWith.
C#

C# HashSet IntersectWith: In-Place Set Intersection

Learn how to use C# HashSet.IntersectWith to compute set intersection in place, with code examples, performance notes, and common pitfalls.

HashSetIntersectWithSet OperationsC# Collections
Diagram showing two overlapping circles merging into a single combined circle, representing the in-place set union operation of HashSet UnionWith.
C#

C# HashSet UnionWith: In-Place Set Union Explained

Learn how HashSet<T>.UnionWith merges elements in place, how it differs from LINQ's Union, and when to use it for efficient set merging.

HashSetSet OperationsLINQC# Collections
Illustration of a C# HashSet removing duplicate elements from a collection, showing unique items remaining.
C#

Using C# HashSet to Remove Duplicates

Learn how to use C# HashSet to remove duplicates from collections, including order preservation, custom equality, and performance tradeoffs.

HashSetC#DeduplicationLINQ
Illustration of a HashSet with a magnifying glass over an item, representing fast Contains lookup.
C#

C# HashSet.Contains: Fast Lookup and Usage

Learn how HashSet.Contains works, its O(1) average lookup, custom type support, and when to choose HashSet over List for membership tests.

HashSetC# CollectionsContains MethodPerformance
Illustration of removing an element from a C# HashSet collection, showing the hash lookup and deletion concept
C#

C# HashSet<T>.Remove: Syntax, Return Value, and Performance

See how HashSet<T>.Remove works in C#: return values, RemoveWhere for conditional deletion, performance behavior, and common pitfalls.

C#HashSet.NET CollectionsData Structures
Illustration of adding elements to a C# HashSet, showing duplicate rejection and unique element storage
C#

C# HashSet Add: Behavior, Performance, and Common Pitfalls

C# HashSet.Add returns a bool that tells you whether an item was inserted. See how duplicates are handled, performance tradeoffs, and common pitfalls.

HashSetC# CollectionsPerformanceData Structures