Mert Özen Further With Every Line

Blog

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

Series
179 posts found #csharp
Encapsulation and Access Modifiers in C#: public, private, protected, internal
Backend PART 03

Encapsulation and Access Modifiers in C#: public, private, protected, internal

Why a get-only List property protects nothing, keeping invariants inside the object, IReadOnlyList versus AsReadOnly, the six access modifiers and their defaults, private belonging to the type, and the assembly boundary with internal and InternalsVisibleTo.

7 Nov 2026 9 min 11
Fields, Properties and Constructors in C#: Building Objects Right
Backend PART 02

Fields, Properties and Constructors in C#: Building Objects Right

The parameterless constructor that disappears once you write your own, private and readonly fields, a validating property, auto-properties, get-only, private set, init and computed properties, constructor chaining and the order in which initializers run.

7 Nov 2026 10 min 9
Classes and Objects in C#: Writing Your First Own Type
Backend PART 01

Classes and Objects in C#: Writing Your First Own Type

A class is a recipe, an object is what it produces in memory. The first Book class with fields and methods, this, what being a reference type means, identity comparison with ==, null and NullReferenceException, and how classes are laid out in files and namespaces.

7 Nov 2026 9 min 8
C# Mini Project: A Console Bookstore (List, Add, Search, Save to a File)
Backend PART 20

C# Mini Project: A Console Bookstore (List, Add, Search, Save to a File)

The closing project of the C# Fundamentals series: a console Bookstore built with enums, DateOnly, nullable types, TryParse, exception filters and file I/O. Two real bugs caught on the first run (14,00 becoming 1400 and a silently deleted line), their fixes, and the bridge to the OOP series.

7 Nov 2026 13 min 11
Debugging in C#: Breakpoints, the Call Stack, Debug.Assert and Compiler Warnings
Backend PART 19

Debugging in C#: Breakpoints, the Call Stack, Debug.Assert and Compiler Warnings

Why doesn't Debug.WriteLine show up in the terminal, and why does Debug.Assert vanish in Release? Debugger concepts independent of the IDE, finding an integer division bug with a watch, reading a stack trace, the anatomy of dotnet build warnings, and turning nullable warnings into errors with WarningsAsErrors.

7 Nov 2026 9 min 11
Organizing C# Code: Namespaces, global using, Solutions and NuGet
Backend PART 18

Organizing C# Code: Namespaces, global using, Solutions and NuGet

Why do you get CS0117 when you reach an internal member from another project? The project and assembly boundary, file-scoped namespaces, global using and the generated implicit usings file, the .slnx solution of the .NET 10 SDK, references between projects, and adding a NuGet package.

7 Nov 2026 8 min 13
Files and the Console in C#: ReadLine, File, Path, Directory, using and Encoding
Backend PART 17

Files and the Console in C#: ReadLine, File, Path, Directory, using and Encoding

Why does the same text take 15 and 18 bytes? UTF-8 and the BOM, Console.ReadLine that can return null, Path.Combine versus Path.Join, one-line reads and writes with File and Directory, relative paths and the working directory, and the empty file of a StreamWriter that was never disposed.

7 Nov 2026 9 min 12
Dates and Times in C#: DateTime, DateTimeOffset, DateOnly, TimeOnly and UTC
Backend PART 16

Dates and Times in C#: DateTime, DateTimeOffset, DateOnly, TimeOnly and UTC

Why do a UTC and a local DateTime with the same numbers compare equal? The Kind problem, DateTimeOffset for pinning down a moment, TimeZoneInfo and daylight saving time, DateOnly and TimeOnly from .NET 6, Days versus TotalDays in TimeSpan, culture-aware formatting and parsing, and the store-in-UTC rule.

7 Nov 2026 9 min 12
Enums in C#: Underlying Types, [Flags], Parse and switch
Backend PART 15

Enums in C#: Underlying Types, [Flags], Parse and switch

The number under an enum: why (OrderStatus)7 is a valid value, why default is 0, giving values by hand, the surprises of Parse and TryParse, the CS8524 warning in switch expressions, and combinable options with [Flags].

7 Nov 2026 9 min 13
Exception Handling in C#: try/catch/finally, throw and Your Own Exception
Backend PART 14

Exception Handling in C#: try/catch/finally, throw and Your Own Exception

Exception handling in C#: try, catch and their order, cleanup with finally and using, how throw and throw ex differ in the stack trace, the when filter, writing your own exception type and using InnerException, and when to use an exception and when TryXxx.

7 Nov 2026 9 min 12
Nullable in C#: int?, string? and Managing Null by Design
Backend PART 13

Nullable in C#: int?, string? and Managing Null by Design

Working with null in C#: Nullable<T> and int?, lifted operators that compute with null, the nullable reference types of C# 8 and their warnings, flow analysis, the ?. ?? ??= and ! operators, and rules for managing null by design.

7 Nov 2026 10 min 13
Value Types and Reference Types in C#: Assignment, Copying and the Special Case of string
Backend PART 12

Value Types and Reference Types in C#: Assignment, Copying and the Special Case of string

The difference between value types and reference types in C#: what gets copied on assignment and when passing to a method, why string behaves like a value type, what is right and what is missing in the stack and heap story, equality, boxing, and struct pitfalls in collections.

7 Nov 2026 9 min 13
Blog Map