Browse by Topic

Popular

Latest

Latest Posts

A diagram showing how SingleOrDefault in C# LINQ returns one element, returns the default for an empty match, and throws an exception for multiple matches.
C#

Using SingleOrDefault in C# LINQ

Learn how SingleOrDefault works in C# LINQ: what it returns for empty or duplicate matches, when it throws InvalidOperationException, and how it compares to FirstOrDefault.

C#LINQSingleOrDefaultException Handling
C# LINQ Single method illustration showing a sequence with exactly one matching element and an exception for multiple matches.
C#

C# LINQ Single: Usage, Exceptions, and When to Use It

Understand C# LINQ Single: how it behaves, when it throws, and how to choose it over SingleOrDefault or First when you need a unique match.

LINQC#SingleOrDefaultException Handling
Editorial illustration comparing C# First and FirstOrDefault LINQ methods showing exception versus default value behavior.
C#

C# First vs FirstOrDefault: Key Differences

Learn when First() throws on an empty sequence and when FirstOrDefault() returns a default value in C# LINQ queries.

LINQC#FirstOrDefaultException Handling
Illustration of C# LINQ FirstOrDefault selecting the first element from a collection or returning a default value when the collection is empty.
C#

C# LINQ FirstOrDefault: Syntax and Defaults

c# linq firstordefault: Learn how C# LINQ FirstOrDefault works, its default value behavior, and common mistakes when using it with sequences.

LINQC#FirstOrDefaultEnumerable
Illustration of C# LINQ First method retrieving the first element from a sequence with a magnifying glass.
C#

C# LINQ First: Syntax, Behavior, and Pitfalls

Learn how to use LINQ First in C# to retrieve the first element from a sequence, handle empty-sequence exceptions, and choose between First and FirstOrDefault.

LINQC#IEnumerableFirstOrDefault
Diagram showing LINQ ThenBy chaining secondary sort keys after OrderBy in C#.
C#

C# LINQ ThenBy: Sorting by Multiple Keys

Learn how to use C# LINQ ThenBy to sort data by multiple keys, handle descending order, and avoid common pitfalls.

LINQC#SortingThenBy
A descending arrow over a set of ordered cards representing C# LINQ OrderByDescending sorting.
C#

C# LINQ OrderByDescending: Sorting in Descending Order

Learn how to sort collections in descending order with C# LINQ OrderByDescending: syntax, key selectors, chained ThenByDescending sorts, null handling, and performance considerations.

LINQC#SortingOrderByDescending
Illustration of C# LINQ OrderBy sorting a collection of objects into ascending order
C#

C# LINQ OrderBy: Syntax, Examples, and Sorting Behavior

Learn how to use C# LINQ OrderBy to sort collections, including OrderByDescending, ThenBy for multiple keys, custom comparers, deferred execution, and performance.

LINQSortingOrderByC# Collections
A diagram showing how C# LINQ SelectMany flattens nested collections into a single sequence
C#

C# LINQ SelectMany: Flattening Nested Collections

Learn how C# LINQ SelectMany flattens nested collections into a single sequence, with syntax examples and performance tradeoffs.

LINQC#IEnumerableData Transformation
Diagram showing LINQ Select transforming a sequence of objects into a projected output sequence.
C#

C# LINQ Select: Syntax, Examples, and Pitfalls

Learn how to use C# LINQ Select to project data, including syntax, index usage, deferred execution, and common pitfalls.

LINQC#SelectProjection