Introduction to Generics in C# Ever hit a wall like this? Yet swap to IEnumerable<Fruit> and it magically works? This trips up devs assuming inheritance flows through generics. It spotlights invariance vs. covariance – List<T> blocks it to prevent bugs, while IEnumerable<out T> enables safe read-only views. Crucial for bulletproof APIs. Core Mechanism Generics like… Continue reading Understanding Generics and Covariance in C#
Tag: OOP
Mastering Infinite Sequences in C#: A Complete Guide
Introduction to Infinite Sequences Infinite sequences in C# represent data streams that generate values indefinitely on demand, without precomputing or storing everything in memory. They leverage lazy evaluation, where elements are produced only when needed, making them ideal for scenarios like simulations or endless data generation. This approach prevents memory exhaustion from unbounded collections. IEnumerable… Continue reading Mastering Infinite Sequences in C#: A Complete Guide
The Onion, the Layer, and the Interface
Modern software architecture is full of metaphors—and none may be as visually striking as the Onion Architecture. But what does it really mean when we talk about “layers,” “abstractions,” and “interfaces”? In this article, we’ll unravel these concepts and explore the foundational principles that shape robust, flexible systems. Peeling Back the Onion The Onion Architecture… Continue reading The Onion, the Layer, and the Interface
The Interface Is Owned by the Client
This one is a less known principle, but with great implications. It is related to the Interface Segregation Principle, as well as to the Dependency Inversion Principle. It also dictates where interfaces should live in a multiple assembly architecture. This is going to be interesting, so hang on to your keyboards. What Do You Mean?… Continue reading The Interface Is Owned by the Client
What is a Constructor?
This article is part of the The Anatomy of a Technical Interview series. The actual question is “What is a constructor, and what role does it play inside of an object?”. Throughout my interview experience I have received a lot of answers to this question. Answers vary in shape and form, but are mostly along… Continue reading What is a Constructor?
How It All Started
This article is part of the The Anatomy of a Technical Interview series. In this series I share with you my experiences and insights that I gathered while holding technical interviews. I’ve seen my fair share of interviews while I was applying for various jobs and positions throughout my carrier. Many of them were either… Continue reading How It All Started