Mert Özen Further With Every Line

Blog

Mert Özen's blog posts on software development, backend, frontend, and DevOps.

Series
20 posts found #linq
LINQ Aggregation Operators: Count, Sum, Average, Min, Max, Aggregate and MinBy/MaxBy
Backend PART 07

LINQ Aggregation Operators: Count, Sum, Average, Min, Max, Aggregate and MinBy/MaxBy

Why Sum returns 0 and Max throws on an empty sequence, and the nullable selector and DefaultIfEmpty fixes. Count and .NET 6 TryGetNonEnumeratedCount, the return type of Average, the checked overflow of Sum, MinBy/MaxBy returning the element instead of the value, the three overloads of Aggregate, and how many times you enumerate the same query.

7 Nov 2026 11 min 9
LINQ Partitioning: Take, Skip, TakeWhile, Chunk and Take(Range)
Backend PART 06

LINQ Partitioning: Take, Skip, TakeWhile, Chunk and Take(Range)

Why TakeWhile is not a filter, correct paging with Skip and Take and the silent rule of ordering, how TakeLast/SkipLast read to the end, Take(Range) from .NET 6 versus array slicing, splitting into batches with Chunk, and exactly how much of the source the partitioning operators read.

7 Nov 2026 10 min 10
LINQ Element Operators: First, Last, Single, ElementAt and OrDefault
Backend PART 05

LINQ Element Operators: First, Last, Single, ElementAt and OrDefault

The First, Last, Single and ElementAt families and their OrDefault siblings; how 0 gets confused with 'not found' on value types, .NET 6's default value parameter and Index overloads, the difference in intent between First and Single, and nullable warnings.

7 Nov 2026 9 min 10
Projection with LINQ: Select, SelectMany and Anonymous Types
Backend PART 04

Projection with LINQ: Select, SelectMany and Anonymous Types

One-to-one projection with Select and one-to-many with SelectMany; mapping to DTOs, keeping parent data with a result selector, the Cartesian product, the equality and with rules of anonymous types, and tuple versus record outside a method.

7 Nov 2026 10 min 11
Filtering and Sorting with LINQ: Where, OrderBy, ThenBy and Reverse
Backend PART 03

Filtering and Sorting with LINQ: Where, OrderBy, ThenBy and Reverse

Where and its index overload, why a second OrderBy wipes out the first, multi-key sorting with ThenBy, stable OrderBy versus unstable List.Sort, culture-sensitive string ordering, and how Reverse differs from OrderByDescending.

7 Nov 2026 10 min 7
LINQ Deferred Execution: When Does a Query Run? IEnumerable and IQueryable
Backend PART 02

LINQ Deferred Execution: When Does a Query Run? IEnumerable and IQueryable

Why a LINQ query runs when it is iterated rather than when it is defined, element-by-element streaming, immediate and buffering operators, the cost of multiple enumeration, and the IEnumerable versus IQueryable split through Func and expression trees.

7 Nov 2026 10 min 8
What Is LINQ? Query Syntax and Method Syntax in C#
Backend PART 01

What Is LINQ? Query Syntax and Method Syntax in C#

What LINQ changes about the queries we used to write with loops, the C# 3.0 features behind it, how the compiler translates query syntax into method calls, when to pick which notation, and the first pitfalls.

7 Nov 2026 11 min 8
LINQ Queries with EF Core: SQL Translation, Client Evaluation and the IQueryable Trap
Database PART 09

LINQ Queries with EF Core: SQL Translation, Client Evaluation and the IQueryable Trap

We follow how an EF Core LINQ query becomes SQL: deferred execution, ToQueryString and LogTo, filtering, sorting and paging, projection, First/Single/Find, client evaluation allowed in the final Select, and the IEnumerable trap that silently pulls the whole table.

5 Nov 2026 12 min 19
Blog Map