Menu

C# Mid-Level Day 3: Generics, Collections, Delegates, Events, LINQ and Iterators, With Six Practice Projects
📰

C# Mid-Level Day 3: Generics, Collections, Delegates, Events, LINQ and Iterators, With Six Practice Projects

DEV Community: dotnet·Manohari Jayachandran·26 days ago
#qUxLcTTr
#devtodotnet#devto#dev#console#writeline
Long article (8960 words) — no AI summary yet.
Reading 0:00
15s threshold

Why this post exists

Days 1 and 2 gave you the language and the object model. Day 3 is where C# stops being merely correct and starts being expressive. The six concepts here are the ones that separate code that works from code that other developers enjoy reading: generics, collections, delegates and lambdas, events, LINQ, and iterators . Almost every real .NET codebase, including every ASP.NET Core and Entity Framework Core project, is built from them.

As before, each concept has what it is, an analogy, a short example, a practice question and a complete solution with the reasons it is written that way. Try each question before reading the solution. Day 4 finishes the mid-level material, and a capstone project follows it.

All code targets .NET 8 or later with top-level statements, so you can paste each solution into the Program.cs of a new console project ( dotnet new console ) and run it.

Concept 1: Generics: classes, methods and constraints

What it is.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.