Mert Özen Further With Every Line

Blog

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

Series
127 posts found #csharp
C# Collection Interfaces: IEnumerable, ICollection, IList and yield return
Backend PART 07

C# Collection Interfaces: IEnumerable, ICollection, IList and yield return

What IEnumerable, ICollection, IList and the IReadOnly* interfaces promise and what they don't; why an array throws on Add, exposing an internal list safely, choosing parameter types and writing lazy iterators with yield return.

7 Nov 2026 11 min 8
Sorted Collections in C#: SortedList, SortedDictionary, SortedSet and IComparer
Backend PART 06

Sorted Collections in C#: SortedList, SortedDictionary, SortedSet and IComparer

A book silently lost from a SortedSet when the comparer returns zero, and the tie-breaking second criterion. SortedDictionary on a red-black tree, SortedList with two sorted arrays and when to pick which; Min, Max and the live GetViewBetween on SortedSet; IComparer, culture-sensitive string order and broken comparer traps.

7 Nov 2026 8 min 8
C# Queue, Stack, LinkedList and PriorityQueue: Collections That Work in Order
Backend PART 05

C# Queue, Stack, LinkedList and PriorityQueue: Collections That Work in Order

Queue<T> for FIFO, Stack<T> for LIFO and undo, LinkedList<T> for O(1) inserts and removals through nodes, and a small LRU cache built from LinkedList and Dictionary. The .NET 6 PriorityQueue: why UnorderedItems is unordered, why it is not stable for equal priorities, a fair queue with sequence numbers, and the N most expensive books with EnqueueDequeue.

7 Nov 2026 8 min 11
C# Dictionary and HashSet: TryGetValue, Key Equality and Comparers
Backend PART 04

C# Dictionary and HashSet: TryGetValue, Key Equality and Comparers

How a Dictionary finds a key with GetHashCode and Equals, and why a class key without equality bloats it. The differences between Add, the indexer, TryAdd and TryGetValue, counting in a single lookup with .NET 6 CollectionsMarshal, the mutable key trap, OrdinalIgnoreCase and the Turkish I trap, ordering, and HashSet set operations.

7 Nov 2026 8 min 6
A Guide to C# List<T>: Adding, Removing, Capacity, Sorting and Searching
Backend PART 03

A Guide to C# List<T>: Adding, Removing, Capacity, Sorting and Searching

Elements skipped while removing in a loop, the 'Collection was modified' error and removing correctly with RemoveAll. The array inside, Capacity growing 4-8-16-32 and EnsureCapacity; Add, Insert, Remove and equality, the Find family, Sort, BinarySearch and why Sort is not stable.

7 Nov 2026 9 min 9
Generic Classes, Generic Methods and Constraints in C#
Backend PART 02

Generic Classes, Generic Methods and Constraints in C#

Writing your own generic classes and methods: paging with Page<T>, the limits of type inference, default and the unconstrained T? trap. The class, struct, new(), notnull, unmanaged and Enum constraints with real compiler errors; per-closed-type statics and the == trap in generic code.

7 Nov 2026 10 min 10
Why C# Has Generics: ArrayList, Boxing and Type Safety
Backend PART 01

Why C# Has Generics: ArrayList, Boxing and Type Safety

The price of ArrayList storing everything as object: InvalidCastException pushed to run time, boxing of value types and eight times the memory. Type safety with List<T>, how the runtime sees generic types, and bringing old collections into the generic world with OfType and Cast.

7 Nov 2026 8 min 9
An Object-Oriented Mini Project in C#: the OOP Bookstore
Backend PART 16

An Object-Oriented Mini Project in C#: the OOP Bookstore

A small bookstore built from every piece of the series: record struct value objects, inheritance, indexers, stock notifications with events, checkout with composition, strategy and factory, a disposable log, and a bridge to the collections series.

7 Nov 2026 12 min 7
A Few Design Patterns in C#: Factory, Strategy and Observer
Backend PART 15

A Few Design Patterns in C#: Factory, Strategy and Observer

What design patterns are for, static factory methods and a switch-based factory, strategy with Func and interfaces, observer with events, isolating a broken subscriber, and subscription leaks.

7 Nov 2026 9 min 11
Partial, Nested Types, Anonymous Types and Tuples in C#
Backend PART 14

Partial, Nested Types, Anonymous Types and Tuples in C#

Equality and limits of anonymous types, returning several values with tuples, why tuple names exist only for the compiler, partial classes and methods, nested types, and when to pick which.

7 Nov 2026 9 min 10
Object Lifetime in C#: the Garbage Collector, IDisposable and using
Backend PART 13

Object Lifetime in C#: the Garbage Collector, IDisposable and using

When using cleans up, the garbage collector's generations and limits, implementing IDisposable correctly, why finalizers are rarely written, and the dispose pattern.

7 Nov 2026 9 min 8
Composition in C# and an Introduction to SOLID
Backend PART 12

Composition in C# and an Introduction to SOLID

How a cart derived from List leaks its rules, having instead of being with composition, the five SOLID principles through Bookstore examples, and the cost of overdoing them.

7 Nov 2026 10 min 9
Blog Map