All syntax guides
Short, practical guides on programming syntax, language fundamentals, and the tools developers reach for every day.
3,965 guides across 14 topics
Topics
Popular guides
Most readLatest guides
Page 351 of 397C# Single vs First: Key Differences and Usage
Understand the differences between C# LINQ Single and First: exception behavior, scanning tradeoffs, and when to use each.
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# 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.
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.
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.
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.
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.
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.
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.
C# LINQ SelectMany: Flattening Nested Collections
Learn how C# LINQ SelectMany flattens nested collections into a single sequence, with syntax examples and performance tradeoffs.