Mert Özen Further With Every Line

Blog

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

Series
8 posts found #generics
C# 11–12 and .NET 7–8: Generic Math, Frozen and Collection Expressions
Backend PART 10

C# 11–12 and .NET 7–8: Generic Math, Frozen and Collection Expressions

The generic sum you couldn't write in C# 10, generic math with static abstract members and INumber<T>; FrozenDictionary and FrozenSet, built once and read many times, measured with BenchmarkDotNet; square-bracket collection expressions, spread and CollectionBuilder.

7 Nov 2026 12 min 6
Generic Variance in C#: Covariance and Contravariance (in and out)
Backend PART 09

Generic Variance in C#: Covariance and Contravariance (in and out)

Why can't a List<EBook> be a List<Book> when it can be an IEnumerable<Book>? The hole in array covariance, covariance with out, contravariance with in, variance in delegates, the limits of the rules and the cast trap CS0266 suggests.

7 Nov 2026 10 min 7
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 8
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 7
TypeScript Indexed Access Types: Deriving Types from Existing Ones with T["key"]
Frontend PART 06

TypeScript Indexed Access Types: Deriving Types from Existing Ones with T["key"]

We look at reading a property's type with T["key"], union indexes, getting an array's element type with T[number], T[K] in generics and deriving pieces from large API types.

3 Nov 2026 8 min 19
Generic Interfaces, Types and Classes in TypeScript: Box, Result and Stack
Frontend PART 03

Generic Interfaces, Types and Classes in TypeScript: Box, Result and Stack

We move type parameters from functions to types: Box<T> as a generic type alias, a paginated list as a generic interface, Result<T, E> for success and failure, and generic Stack and Registry classes.

3 Nov 2026 7 min 27
Generic Constraints in TypeScript: extends, Default Types, const and NoInfer
Frontend PART 02

Generic Constraints in TypeScript: extends, Default Types, const and NoInfer

We constrain type parameters with extends, tie two parameters together with keyof, use default type parameters, and steer inference with TS 5.0 const type parameters and TS 5.4 NoInfer.

3 Nov 2026 7 min 20
Introduction to Generics in TypeScript: Taking the Type as a Parameter
Frontend PART 01

Introduction to Generics in TypeScript: Taking the Type as a Parameter

Why generic functions exist, how a type parameter ties input to output, how TypeScript infers T, and how generics differ from any and unknown, with small examples.

3 Nov 2026 8 min 21
Blog Map