C#
From language basics to LINQ, async/await, and the .NET ecosystem; modern features and best practices for production-ready apps.
What is C#?
C# is a statically typed language developed by Microsoft that blends object-oriented and functional features. With .NET 8 it is cross-platform (Windows, Linux, macOS) and used for web APIs, desktop apps, cloud services, background jobs, and games (Unity) across a wide range.
Ecosystem: ASP.NET Core (web), Entity Framework Core (data access), xUnit/NUnit (testing), NuGet (package management), and the dotnet CLI (command line).
TL;DR
- Modern C#:
records, pattern matching,async/await, and span/memory for performance. - Fast REST services with Minimal APIs; efficient CRUD and LINQ with EF Core.
- Layered architecture + dependency injection for testable design.
Language Basics
Fundamentals of C# syntax, type system, and control flow. The first stop for beginners to grasp the logic of the language.
Introduction to C# and the .NET Ecosystem
C# is a modern, safe, and object-oriented language. With the .NET ecosystem, it is possible to develop web, mobile, desktop, and game applications.
First C# Project
First console app in C# with Visual Studio 2022: usage of WriteLine, ReadKey, and ReadLine.
C# Basic Data Types
Basic data types in C#: numeric, text, logical, object-based, and nullable types.
C# Syntax Structure
Learn the basics of C# syntax, including code blocks, comments, and variable naming rules, with clear explanations and practical examples.
C# Operators and Expressions
Operators and expressions in C#: arithmetic, comparison, logical, increment/decrement, ternary, and null-coalescing usage.
C# Conditional Statements (if, else, switch)
Decision structures in C#: learn how to use if, else if, else and switch to perform different actions based on conditions.
C# Loops (for, foreach, while, do-while)
Learn how to use for, foreach, while, and do-while loops in C#. Discover practical examples for handling repeated operations in C# applications.
C# Console Commands
Learn how to work with the C# console by writing output, reading user input, and formatting text with practical examples.
C# String Operations
Learn how to work with strings in C#, including concatenation, searching, substring, IndexOf, and other essential string operations.
C# Type Conversions
Learn how type conversions work in C#, including implicit and explicit casting, Parse, TryParse, and Convert methods with examples.
Using Constants and Enums in C#
Learn how to use constants and enums in C# to write cleaner, safer, and more maintainable code with clear explanations and examples.
C# Math Library
Learn how to use the C# Math library, including Pow, Sqrt, Round, Abs, and other essential mathematical methods with examples.
C# Boolean Operations
Learn how boolean operations work in C#, including the bool type, comparisons, and logical operators like &&, ||, and ! with examples.
DateTime & TimeSpan Operations in C#
Learn how to work with DateTime and TimeSpan in C# to perform date and time operations such as comparison, addition, subtraction, and formatting.
Random Operations in C#
Learn how to use the Random class in C# to generate random numbers, values, and selections using Next, NextDouble, and examples.
Methods and Parameter Usage in C#
Learn how to define methods and use parameters in C#, including value and reference parameters, optional parameters, and examples.
C# Exception Handling (try, catch, finally)
Learn how to handle exceptions in C# using try, catch, and finally blocks to manage errors safely with clear examples.
Namespaces and Assemblies in C#
Learn how namespaces and assemblies work in C# to organize code, manage dependencies, and structure projects effectively.
Object-Oriented Programming (OOP) and Patterns
Classes, inheritance, interfaces, and design patterns to write reusable and maintainable code in C#.
Class, Object, Property and Methods in C#
Learn how classes, objects, properties, and methods work in C# and form the core building blocks of object-oriented programming.
Structs in C# – Differences from Classes
Learn the key differences between structs and classes in C#, including memory model, inheritance, boxing, and performance.
Constructors, Destructors and this in C#
Learn how constructors, destructors, and the this keyword work in C# to manage object lifecycle and class-level access.
Sealed, Static, and Partial Classes in C#
Learn the purpose, differences, and use cases of sealed, static, and partial classes in C# with practical examples.
Record Types and Immutable Objects in C#
Learn C# record types and immutable objects, including value equality, with-expressions, and patterns for building safer data models.
Encapsulation, Inheritance, and Polymorphism in C#
Learn encapsulation, inheritance, and polymorphism in C# with clear examples to understand core OOP principles and real use cases.
Interfaces and Abstract Classes in C#
Learn interfaces and abstract classes in C#, their differences, and when to use each approach to design clean and extensible code.
Delegates and Events in C#
Learn delegates and events in C# to build event-driven applications using callbacks, subscriptions, and real-world examples.
Lambda Expressions in C#
Learn lambda expressions in C#, including concise syntax, Func and Action delegates, and practical LINQ usage examples.
Extension Methods in C#
Learn extension methods in C# to add new functionality to existing types without modifying their source code.
Dependency Injection Basics in C#
Learn the basics of Dependency Injection in C#, including managing dependencies, loose coupling, and improving testability.
SOLID Principles with C#
Applying SOLID principles in C# with examples: building flexible, maintainable, and testable code.
Design Patterns in C# (Factory, Singleton, Repository, Observer)
Learn design patterns in C#, including Factory, Singleton, Repository, and Observer, to build flexible and maintainable applications.
Interop in C# (Working with C/C++ Libraries)
Learn how to use Interop in C# to work with C/C++ libraries, including P/Invoke, unmanaged code, and data marshaling.
Data and Collections
Arrays, collections, generics, and LINQ for effective data handling and querying in C#.
Arrays in C#
Learn arrays in C#, including declaration, indexing, looping through elements, and common array operations with examples.
Collections in C#: List, Dictionary, Queue, Stack
Learn C# collections like List, Dictionary, Queue, and Stack to store and manage data efficiently with practical examples.
Generics in C# (List<T>, Dictionary<TKey,TValue>)
Learn generics in C#, including List<T> and Dictionary<TKey,TValue>, to write type-safe and reusable code with examples.
LINQ Basics in C# (Where, Select, OrderBy)
Learn LINQ basics in C# using Where, Select, and OrderBy to query, filter, and sort collections with practical examples.
Zip a Folder with Progress in .NET (WPF Example)
Create a ZIP from a folder in .NET while reporting progress to a WPF ProgressBar using ZipArchive and IProgress for smooth UI updates.
Standard API Response Wrapper in ASP.NET Core (Result)
Standardize success and error responses in ASP.NET Core using a Result
IP Rate Limiting in ASP.NET Core (.NET 8): Return 429 Too Many Requests
Limit requests per IP using .NET 8’s built-in rate limiting middleware and return 429 with Retry-After to protect your API from abuse.
ProblemDetails in ASP.NET Core: Clean Error Responses with TraceId
Map exceptions to RFC 7807 ProblemDetails and include a traceId so clients get consistent errors and you can match the exact request in logs.
Cleaner Pagination in ASP.NET Core Web API (Headers + Link)
Return only items in the body and move pagination metadata to headers. Add RFC 5988 Link header (next/prev) for clean, predictable API navigation.