Browse by Topic

Popular

Latest

Latest Posts

Diagram showing a C# dictionary declaration mapping string keys to integer values with a clean arrow between key and value boxes.
C#

C# Dictionary Declaration: Syntax and Initialization

Learn how to write a C# dictionary declaration with type parameters, collection initializers, initial capacity, custom comparers, and performance tradeoffs.

DictionaryC# CollectionsCollection InitializerGeneric Types
A visual representation of a C# dictionary mapping keys to values, with a magnifying glass indicating fast lookup.
C#

C# Dictionary Usage: Key Operations and Performance

Learn practical C# Dictionary operations: fast key-value lookups, missing-key handling, performance considerations, and thread-safe alternatives.

C# DictionaryCollectionsPerformanceThread Safety
Illustration of a C# list with duplicate items being filtered into a unique list using a HashSet and LINQ, showing order preservation.
C#

Remove Duplicates from a List in C#

Learn how to remove duplicates from a List<T> in C# using LINQ Distinct, HashSet, and custom comparers, with performance tradeoffs, order preservation, and in-place removal.

C#LINQList<T>HashSet
Illustration of an array being converted to a list in C# with arrows and brackets.
C#

C# Array to List: Conversion Methods and Performance

Learn how to convert a C# array to a List with ToList() or the List<T> constructor, including performance, memory, and common pitfalls.

C#ArraysListsLINQ
Diagram showing a C# List<T> being converted to an array with ToArray(), illustrating the element copy process.
C#

C# List to Array: Converting Collections with ToArray()

Convert a List<T> to an array in C# with ToArray() or CopyTo(), and understand the type, performance, and memory implications of each approach.

C#.NETList<T>Arrays
Illustration of a C# List showing Count as the number of filled slots and Capacity as the total allocated slots.
C#

C# List Count vs Capacity: Key Differences

Understand the difference between Count and Capacity in C# List<T>, and see how setting Capacity can affect memory usage and performance.

C#List<T>performancememory management
Diagram comparing the Count property on a C# List<T> with the LINQ Count() extension method, showing how both return the number of elements.
C#

C# List Count: Count Property vs Count() Method

Compare the List<T>.Count property and the LINQ Count() method: how they behave on List<T>, performance traits, and when to use Count() over Count.

C#List<T>LINQ.NET Collections
Illustration of a C# foreach loop iterating over a list with an enumerator pointer.
C#

C# List foreach: Syntax, Pitfalls, and Performance

Learn how to use foreach with List<T> in C#, including syntax, enumerator behavior, common pitfalls, and performance tradeoffs.

C#ListforeachIEnumerable
Illustration of reversing the order of elements in a C# List, showing in-place and LINQ approaches.
C#

How to Reverse a List in C#: In-Place and LINQ

Reverse a C# List<T> with List.Reverse() or LINQ's Reverse(). Compare in-place mutation, deferred enumeration, and practical tradeoffs.

C#ListLINQCollections
Visual metaphor of a C# List being sorted, showing an unordered list transforming into an ordered sequence with arrows.
C#

C# List Sort: List.Sort vs LINQ OrderBy

Learn how to sort a List<T> in C# using List.Sort and LINQ OrderBy, including custom comparers, multiple-key sorting, and performance tradeoffs.

C#List<T>SortingLINQ