Skip to content
Tutorials Center
My learning

Topics

C# Tutorial

Learn C# 14 on .NET 10 from your first program to LINQ, async, ASP.NET Core and real projects. 182 lessons with C# that compiles and runs in your browser, quizzes and projects.

Start learning →

of lessons completed

Getting Started

  1. 1 Getting Started with C# Start learning C# 14 on .NET 10. Learn what C# and .NET are, where they are used, and write and run your first program right in your browser.
  2. 2 How C# and .NET Work Understand how C# source code becomes a running program on .NET 10 - the Roslyn compiler, IL, assemblies, the JIT and CLR, NuGet, and the dotnet CLI.
  3. 3 CTS, CLS, Managed Code and Assemblies Understand the .NET vocabulary behind C# - the Common Type System, the Common Language Specification, managed and unmanaged code, assemblies and metadata, and how .NET Framework became .NET 10.
  4. 4 C# Syntax Learn the basic C# syntax - statements, blocks, case sensitivity, naming conventions, namespaces, using directives and how to read compiler error codes.
  5. 5 Program Structure: Top-Level Statements and Main Learn how a C# program starts - top-level statements, the generated Program class, an explicit Main method, args, exit codes, async Main and file layout.
  6. 6 Comments and XML Documentation Learn C# comments - single-line, multi-line and /// XML documentation comments, common doc tags, #region, #pragma, #nullable directives and good commenting habits.
  7. 7 Console Output and Formatting Print text in C# with Console.Write and WriteLine, string interpolation, composite formatting, format specifiers (N2, C, P, D, X, E), alignment and Console.Error.
  8. 8 Reading Input Learn how C# programs read input - Console.ReadLine and null at end of input, parsing with int.Parse and TryParse, validation loops and reading all lines at once.
  9. 9 The dotnet CLI, Projects and Tooling Learn the dotnet CLI commands, how a .csproj file works, what Nullable and ImplicitUsings do, file-based apps, global.json and which editor to pick for C#.

Variables and Types

  1. 10 Variables and var Learn C# variables - declaring and assigning, definite assignment, var type inference, default values, scope rules, naming conventions and discards.
  2. 11 Constants and readonly Learn the difference between const, readonly and static readonly in C# - compile-time constants, constant expressions, versioning traps and when to use each.
  3. 12 Value Types and Reference Types Understand C# value types and reference types - copy semantics, null, the stack and heap, boxing, struct vs class, the type hierarchy and ReferenceEquals.
  4. 13 Integer Types Learn every C# integer type from sbyte to ulong, nint, Int128 and BigInteger - ranges, literals, overflow, checked and unchecked, and integer division pitfalls.
  5. 14 Floating-Point and decimal Learn C# float, double, decimal and Half - why 0.1 + 0.2 is not 0.3, NaN and Infinity, decimal for money, Math.Round modes and comparing with a tolerance.
  6. 15 bool and char Learn the C# bool and char types - true and false, logical operators, char as a UTF-16 code unit, escape sequences, char.IsLetter and friends, surrogate pairs and char arithmetic.
  7. 16 Type Conversion and Casting Learn C# type conversion - implicit and explicit casts, truncation and overflow, the Convert class, Parse and TryParse, is and as, user-defined conversions and BitConverter.
  8. 17 Nullable Value Types Learn C# nullable value types - int?, HasValue, Value, GetValueOrDefault, lifted operators, the ?? and ??= operators, null propagation and boxing of nullable values.
  9. 18 Enums and Flags Learn C# enums - declaring named constants, underlying types, Enum.Parse and TryParse, GetValues, [Flags] with bitwise operations, switch expressions and the undefined value pitfall.

Operators and Control Flow

  1. 19 Operators Learn every everyday C# operator - arithmetic, comparison, short-circuit logic, bitwise and shift (including >>>), compound assignment, ++ and --, the ternary operator and precedence.
  2. 20 if, else if and else Learn C# if, else if and else statements - conditions, nesting, guard clauses, the ternary operator, simplifying boolean logic and the mistakes that trip up beginners.
  3. 21 switch Statements and Expressions Learn the C# switch statement and the modern switch expression - case labels, fall-through rules, goto case, when guards, exhaustiveness, the discard pattern and when to choose each form.
  4. 22 while, do-while and for Loops Learn the three classic C# loops - while, do-while and for - with loop variable scope, nested loops, infinite loops with break, loop invariants and how to avoid off-by-one errors.
  5. 23 foreach and Iteration Learn the C# foreach loop - iterating arrays, lists, strings and dictionaries, the read-only iteration variable, why modifying a collection throws, and getting indexes with Index().
  6. 24 break, continue, goto and return Learn the C# jump statements - break, continue, return, throw and goto with labels - and the best ways to leave nested loops, plus common traps such as break inside a switch.
  7. 25 Ranges and Indices Learn C# index-from-end (^1) and range (1..3) syntax, the Index and Range types, slicing arrays, strings and spans, and how to make your own types support ranges.
  8. 26 Pattern Matching Basics Learn the basics of C# pattern matching - the is operator, type, constant, null, relational and logical patterns, property patterns, and how patterns work in switch expressions.

Strings

  1. 27 Strings Learn how C# strings work - immutability, creating strings, string vs String, null and empty checks, equality, StringComparison, ordinal vs culture rules and interning.
  2. 28 Working with Strings A practical guide to C# string methods - Substring, IndexOf, Contains, Replace, Split, Join, Trim, Pad, Insert, Remove, case conversion, spans and counting characters.
  3. 29 Interpolation and Formatting Master C# string interpolation and formatting - alignment, format specifiers, IFormatProvider and culture, custom ToString and IFormattable, string.Format and interpolated string handlers.
  4. 30 StringBuilder Learn why repeated string concatenation is slow and how StringBuilder fixes it - Append, Insert, Remove, capacity, AppendJoin, chunks, plus string.Concat, string.Join and string.Create.
  5. 31 Raw, Verbatim and UTF-8 String Literals Learn C# string literal forms - escape sequences, verbatim @ strings, raw string literals with triple quotes and interpolation, indentation rules, multi-line text and u8 UTF-8 literals.
  6. 32 Unicode, Rune and Encoding Understand UTF-16 code units, surrogate pairs, Rune, text elements, Encoding.UTF8 byte counts and Unicode normalization in C#, with runnable examples and common pitfalls.
  7. 33 Regular Expressions Learn C# regular expressions with System.Text.RegularExpressions - IsMatch, Match, Matches, Replace, Split, named groups, options, GeneratedRegex and how to avoid catastrophic backtracking.

Methods

  1. 34 Methods Learn how to write and call C# methods - declaration syntax, parameters and arguments, return values, void, overloading, method signatures, naming rules, static vs instance methods and XML docs.
  2. 35 Parameters: ref, out, in and params Master C# parameter passing - by value vs by reference, ref, out variables and discards, in and ref readonly, params arrays and params collections (C# 13), plus ref returns and ref locals.
  3. 36 Optional and Named Arguments Learn C# optional parameters with default values, named arguments and their ordering rules, how overloads compete with defaults, and the CallerMemberName and CallerArgumentExpression attributes.
  4. 37 Expression-Bodied Members and Local Functions Learn C# expression-bodied members with =>, throw expressions, local functions, static local functions, closures versus static, and recursion inside local functions, with runnable examples.
  5. 38 Recursion Learn recursion in C# - base cases, how the call stack grows, why StackOverflowException cannot be caught, memoization with Dictionary, and when a loop is better.
  6. 39 Lambda Expressions Learn C# lambda expressions - the => syntax, Func and Action, natural types, captured variables, static lambdas, default parameters and attributes, with runnable examples.
  7. 40 Tuples and Deconstruction Learn C# tuples - ValueTuple syntax, named elements, returning several values from a method, deconstruction, discards, tuple equality, and when to use records or out instead.

Collections

  1. 41 Arrays Learn C# arrays - creating and initializing, indexing, Length, multidimensional vs jagged arrays, Array.Sort, Copy, Resize, IndexOf, covariance pitfalls and array vs List.
  2. 42 List of T Learn C# List<T> - creating, Add, Insert, Remove, RemoveAll, IndexOf, Contains, Sort with Comparison, capacity growth, performance costs and common pitfalls.
  3. 43 Dictionary of TKey, TValue Learn the C# Dictionary<TKey, TValue> - adding, indexer, TryGetValue, GetValueOrDefault, TryAdd, iteration, key equality and GetHashCode, custom comparers and ordering.
  4. 44 HashSet, SortedSet and Set Operations Learn C# sets - HashSet and SortedSet, uniqueness, Add returning a bool, union, intersection, difference, subset checks, custom comparers and what each operation costs.
  5. 45 Stack, Queue, LinkedList and PriorityQueue Learn the C# collections for ordering work - Stack (LIFO), Queue (FIFO), LinkedList nodes and PriorityQueue - with Peek, TryPeek, BFS, undo history and task scheduling examples.
  6. 46 SortedDictionary, SortedList and Ordering Learn C# sorted collections - SortedDictionary vs SortedList vs Dictionary, binary search, IComparable and IComparer, custom ordering, and why List.Sort is unstable but OrderBy is stable.
  7. 47 Collection Expressions and Spread Learn C# 12 collection expressions - the [1, 2, ..other] syntax, target types, the spread element, empty [], custom collection builders and the performance behind them.
  8. 48 Immutable, Frozen and Read-only Collections Learn the difference between read-only views, ImmutableArray, ImmutableList, ImmutableDictionary and FrozenDictionary in C#, with builders, copy-on-change behaviour and when to choose each.
  9. 49 IEnumerable, ICollection and IList Understand the C# collection interface hierarchy - IEnumerable, ICollection, IList - how foreach and IEnumerator work by hand, yield return, custom collections and covariance.
  10. 50 Non-Generic and Specialized Collections Meet the pre-generics C# collections - ArrayList, Hashtable, BitArray, OrderedDictionary and NameValueCollection - see why generics replaced them, and learn how to migrate old code.
  11. 51 Choosing the Right Collection Pick the right C# collection for the job - List, Dictionary, HashSet, Queue, Stack, SortedSet, Frozen and Concurrent collections - with a decision table, Big O costs and runnable demos.
  12. 52 IComparable and IComparer Learn how C# decides what "smaller" means. Implement IComparable<T>, write IComparer<T> classes and Comparison delegates, sort by several keys and avoid common bugs.

Classes and Objects

  1. 53 Classes and Objects Learn C# classes and objects from scratch - declaring a class, fields, methods, new, reference semantics, null, object initializers, and the difference between static and instance members.
  2. 54 Properties Master C# properties - get and set accessors, auto-properties, init-only and required members, computed properties, validation in setters, backing fields and the C# 14 field keyword.
  3. 55 Constructors and Object Initialization Learn C# constructors - default and overloaded constructors, this(...) chaining, static constructors, object and collection initializers, and the exact order in which an object is initialized.
  4. 56 Primary Constructors Learn C# 12 primary constructors for classes and structs - captured parameters, initializers, validation, how they differ from records, dependency injection use and when to avoid them.
  5. 57 Static Members and Static Classes Understand C# static fields, methods, properties and classes - when shared state makes sense, extension method classes, the singleton pattern, and why global state hurts testing and dependency injection.
  6. 58 Access Modifiers and Encapsulation Learn C# access modifiers - public, private, protected, internal, protected internal, private protected and file - and how encapsulation keeps objects valid and code easy to change.
  7. 59 Inheritance Learn C# inheritance - base and derived classes, calling base constructors, protected members, sealed classes, is-a versus has-a and why composition often beats inheritance.
  8. 60 Polymorphism: virtual, override and new Learn C# polymorphism - virtual and override methods, dynamic dispatch, calling base, abstract members, covariant returns and the new keyword hiding trap, with runnable examples.
  9. 61 Abstract Classes and Interfaces Learn C# abstract classes and interfaces - when to use each, explicit implementation, default interface methods, static abstract members and a clear rule for choosing between them.
  10. 62 The object Class: Equals, GetHashCode and ToString Learn the C# object methods - reference vs value equality, overriding Equals and GetHashCode together, IEquatable<T>, ToString, GetType and MemberwiseClone with runnable examples.
  11. 63 Records Learn C# records - positional records, value equality, with-expressions, deconstruction, init-only properties, inheritance, record struct and readonly record struct, with runnable examples.
  12. 64 Structs Learn C# structs - copy semantics, struct vs class, constructors and default values, readonly structs, the mutable struct trap, record struct, ref struct and when to choose a struct.
  13. 65 Operator Overloading and Conversions Learn C# operator overloading - arithmetic, comparison and equality operators, implicit and explicit conversions, true/false, checked operators and C# 14 compound assignment operators.
  14. 66 Indexers and Custom Iterators Learn C# indexers (this[]), multi-parameter and string indexers, Index and Range support, how foreach calls GetEnumerator, writing iterators with yield return and building a custom collection.
  15. 67 Extension Methods and Extension Members Learn C# extension methods - the this parameter, static classes, namespaces and discoverability, how LINQ works, plus C# 14 extension blocks with extension properties and static members.
  16. 68 Partial, Nested and Local Types Learn C# partial classes, partial methods and partial properties, how code generators use them, nested types, file-scoped types, anonymous types and why C# has no local classes.
  17. 69 Designing with Objects: SOLID in C# Learn the SOLID principles in C# with small runnable examples - single responsibility, open/closed, Liskov substitution, interface segregation, dependency inversion, plus composition and immutability.

Generics

  1. 70 Generics Learn C# generics from scratch: generic classes, methods and interfaces, type parameters, inference, default(T), and why generics beat object and boxing.
  2. 71 Generic Constraints Learn C# generic constraints: class, struct, new(), notnull, unmanaged, base classes, interfaces, combining them, allows ref struct, and good design.
  3. 72 Generic Methods and Delegates Learn C# generic methods and delegates: type inference rules, explicit type arguments, Func and custom delegates, per-type caching and reflection basics.
  4. 73 Covariance and Contravariance Understand C# covariance and contravariance with out and in, IEnumerable of T, Func and Action variance, the array covariance trap and variant interfaces.
  5. 74 Generic Math and Static Abstract Members Learn C# generic math (C# 11, .NET 7): INumber of T, operator interfaces, writing Sum once for all numeric types, static abstract members and parsing.

Delegates, Events and LINQ

  1. 75 Delegates Learn C# delegates: delegate types, Func, Action and Predicate, method groups, multicast, safe invocation, callbacks, strategies and allocation costs.
  2. 76 Events Learn C# events step by step - the event keyword, EventHandler<T>, event args, subscribing and unsubscribing, memory leaks, thread-safety and weak event ideas.
  3. 77 LINQ Basics Learn LINQ in C# from scratch - Where, Select, OrderBy, First, Any, Count, ToList, anonymous projections and how an IEnumerable pipeline works, with runnable examples.
  4. 78 LINQ Operators in Depth Go beyond Where and Select - GroupBy, Join, GroupJoin, LeftJoin, SelectMany, Zip, Aggregate, set operations, Chunk, CountBy and AggregateBy in C# with runnable examples.
  5. 79 Deferred Execution and LINQ Pitfalls Understand LINQ deferred execution in C# - lazy queries, multiple enumeration, ToList snapshots, captured variables, side effects, stable sorting and LINQ versus loops.
  6. 80 LINQ Query Syntax Learn C# LINQ query syntax - from, where, select, orderby, group by, join, let and into - how it translates to method calls, and when it reads better than method syntax.
  7. 81 LINQ Practice: Reports and Transformations Practice C# LINQ on a small dataset - top-N, grouped totals, pivot tables, flattening, paging, sliding windows with Zip and Chunk, with runnable worked examples.
  8. 82 Iterators and yield Learn how C# iterators work - yield return, yield break, the compiler state machine, lazy and infinite sequences, exceptions and finally in iterators, validation, and a preview of IAsyncEnumerable.

Null Safety and Errors

  1. 83 Nullable Reference Types Learn C# nullable reference types - string versus string?, compiler flow analysis, the null-forgiving operator, nullable attributes, required members, and how to migrate an old codebase safely.
  2. 84 Null-Handling Operators Master C# null-handling operators - null-conditional ?. and ?[], null-coalescing ?? and ??=, is null patterns, C# 14 null-conditional assignment, ThrowIfNull and the null object pattern.
  3. 85 Exceptions Learn C# exception handling - try/catch/finally, the exception hierarchy, catch order, throw versus throw ex, stack traces, finally ordering, unhandled exceptions and exit codes, with runnable examples.
  4. 86 Custom Exceptions and Exception Design Learn to write custom exception classes in C#, add data, chain InnerException, handle AggregateException, decide between throwing and returning errors, and use guard clauses like ThrowIfNull.
  5. 87 Exception Filters and Error Handling Patterns Learn C# exception filters with when, the TryParse pattern, Result types, ExceptionDispatchInfo, retry with backoff, and global handlers for unhandled exceptions, with runnable examples.
  6. 88 IDisposable, using and Finalizers Learn how C# releases files, connections and other resources with IDisposable, using statements and declarations, the dispose pattern, finalizers and await using.
  7. 89 Validating Input and Defensive Programming Learn how to validate arguments, guard preconditions, use Debug.Assert, DataAnnotations and invariants, and fail fast so bugs in C# programs are caught early and clearly.

Pattern Matching and Modern C#

  1. 90 Pattern Matching in Depth Master advanced C# pattern matching - nested property patterns, positional patterns, var and discard patterns, switch expressions, when guards, parentheses and exhaustiveness.
  2. 91 List and Slice Patterns Learn C# 11 list patterns and slice patterns - match arrays, lists, strings and spans by shape with [first, .., last], capture slices with var, and write small parsers.
  3. 92 Modeling with Records and Pattern Matching Model data with sealed record hierarchies and pattern matching in C#. Build discriminated-union style types, state machines and an expression evaluator, plus a look at the union proposal.
  4. 93 What's New in C# 8 to 14 A version-by-version tour of C# 8 to 14 with short runnable examples - nullable references, records, raw strings, primary constructors, collection expressions, the field keyword and extension members.
  5. 94 C# 14 Features in Depth A hands-on tour of C# 14 on .NET 10 - extension members, the field keyword, null-conditional assignment, span conversions, partial constructors, lambda modifiers and more.

Async and Concurrency

  1. 95 Threads Learn C# threads from scratch - starting a Thread, Join, foreground and background threads, race conditions and lock, the ThreadPool, ThreadLocal and why tasks are usually better.
  2. 96 Tasks and the Task Parallel Library Learn C# tasks - Task.Run, Task<T>, Wait and Result pitfalls, continuations, exceptions inside tasks, TaskCompletionSource and Task.Delay, with runnable examples.
  3. 97 async and await Understand C# async and await - how the state machine works, writing async methods, the async void trap, ConfigureAwait, async Main, sync-over-async deadlocks and ValueTask.
  4. 98 WhenAll, WhenAny and Task.WhenEach Combine tasks in C# - Task.WhenAll, Task.WhenAny, Task.WhenEach, timeouts with WaitAsync, Parallel.ForEachAsync and throttling async work with SemaphoreSlim.
  5. 99 Cancellation and Timeouts Learn cooperative cancellation in C# - CancellationTokenSource, CancellationToken, OperationCanceledException, CancelAfter timeouts, linked tokens and PeriodicTimer.
  6. 100 Parallel and PLINQ Learn data parallelism in C# - Parallel.For, Parallel.ForEach, Parallel.Invoke, ForEachAsync, PLINQ with AsParallel and AsOrdered, partitioning, and when parallel code is slower.
  7. 101 lock, Lock and Interlocked Make shared data thread-safe in C# - the lock statement, System.Threading.Lock, Monitor, Interlocked, Volatile, deadlocks and how to avoid them, SemaphoreSlim and ReaderWriterLockSlim.
  8. 102 Concurrent Collections Learn the thread-safe collections in C# - ConcurrentDictionary and its GetOrAdd pitfall, ConcurrentQueue, ConcurrentBag, BlockingCollection, and immutable snapshots as an alternative to locking.
  9. 103 Channels and Producer-Consumer Learn System.Threading.Channels in C# - bounded and unbounded channels, writers and readers, back-pressure, multiple consumers, pipelines, completion, errors and await foreach with ReadAllAsync.
  10. 104 Async Streams Learn async streams in C# - IAsyncEnumerable of T, await foreach, async iterator methods with yield return, cancellation with EnumeratorCancellation, paging APIs, cleanup and async LINQ in .NET 10.
  11. 105 Async Patterns and Pitfalls Avoid the classic async and await mistakes in C# - forgotten await, fire-and-forget, async void, sync-over-async deadlocks, context capture, lost exceptions, async disposal, testing, and a checklist.
  12. 106 Timers: PeriodicTimer and System.Threading.Timer Run recurring work in C# with PeriodicTimer, System.Threading.Timer and Task.Delay loops. Learn which to choose, how to stop cleanly and how to avoid overlapping ticks.

Memory and Performance

  1. 107 Garbage Collection Understand how the .NET garbage collector finds dead objects, why it uses generations, what roots and finalizers are, and how to work with it instead of fighting it.
  2. 108 Span, Memory and Slicing Learn Span<T>, ReadOnlySpan<T>, stackalloc and Memory<T> in C#: slice arrays and strings without allocating, parse text fast and understand the ref struct rules.
  3. 109 Boxing, Unboxing and Value Semantics Learn what boxing and unboxing do in C#, how to count the allocations they cause, how generics avoid them, and how struct copying, readonly struct and in parameters work.
  4. 110 Measuring and Improving Performance Learn how to measure C# performance honestly: Stopwatch pitfalls, counting operations and allocations, BenchmarkDotNet, and the common wins such as StringBuilder and sized collections.
  5. 111 Fast Lookups: SearchValues, FrozenDictionary and Caching Speed up repeated lookups in C# with SearchValues, FrozenDictionary and FrozenSet, MemoryCache, Lazy<T> and ArrayPool, and learn when each tool is worth its complexity.
  6. 112 Unsafe Code and Interop Learn when and how to use unsafe code in C#: pointers, fixed, stackalloc, NativeMemory, Marshal and P/Invoke for calling native libraries, plus NativeAOT limits and safer options.
  7. 113 Benchmarking with BenchmarkDotNet Learn to measure C# performance correctly - why Stopwatch timings mislead, how BenchmarkDotNet warms up and repeats, memory diagnosers, Params, baselines and how to read the results.

Standard Library

  1. 114 Dates and Times Learn C# dates and times - DateTime kinds, DateTimeOffset, TimeSpan, DateOnly, TimeOnly, formatting, parsing, time zones and TimeProvider for testable code.
  2. 115 Math, BigInteger and Random Learn the C# Math class, rounding modes, BigInteger, Complex, Int128, seeded Random, secure random numbers and safe number parsing, with runnable examples.
  3. 116 Files, Paths and Directories Learn C# file handling - File, Directory and Path classes, reading and writing text, File.ReadLines, FileStream, async I/O, temp files and safe path handling.
  4. 117 Streams, Readers and Writers Learn C# streams - Stream, MemoryStream, StreamReader and StreamWriter, BinaryReader and BinaryWriter, buffering, GZip and Brotli compression, and pipelines.
  5. 118 JSON with System.Text.Json Learn System.Text.Json in C# - serialize and deserialize objects and records, naming policies, attributes, JsonDocument, JsonNode, custom converters and polymorphism.
  6. 119 XML, CSV and Other Formats Learn to work with XML using LINQ to XML and XmlSerializer, write and parse CSV by hand, encode Base64 and hex, use UTF-8 helpers and parse URIs in C#.
  7. 120 HttpClient Learn C# HttpClient: send GET and POST requests, read status codes and headers, use JSON helpers, set timeouts, reuse clients and meet IHttpClientFactory.
  8. 121 Environment, Arguments and Process Learn how C# programs talk to their surroundings: command-line args, environment variables, exit codes, console redirection, Process, Stopwatch and culture.
  9. 122 Reflection and Attributes Learn C# reflection: typeof and GetType, reading properties and methods, Activator, custom attributes, generic types, performance costs and source generators.
  10. 123 Expression Trees and Dynamic Learn C# expression trees: Expression<Func<>>, building and compiling code at run time, visiting trees, plus dynamic, ExpandoObject and the DLR.
  11. 124 TCP, UDP and Named Pipes Learn network programming in C#: build a TCP echo server with TcpListener and TcpClient, send UDP datagrams, use raw Socket, and talk between processes with named pipes.
  12. 125 Zip and GZip Compression Learn C# compression with System.IO.Compression. Use GZipStream, DeflateStream and BrotliStream, compress strings and files, and create and read ZIP archives in memory.
  13. 126 Cryptography and Hashing Learn practical C# cryptography with System.Security.Cryptography - SHA-256 hashing, HMAC, AES-GCM encryption, random bytes, and password hashing with PBKDF2.
  14. 127 Images with ImageSharp Learn image processing in C#: load, resize, crop, convert and draw on images with SixLabors ImageSharp, plus how pixels work, shown with runnable pixel-buffer examples.
  15. 128 Localization and Globalization Learn globalization and localization in C# and ASP.NET Core - cultures, number and date formats, resource files with fallback, plural rules and Accept-Language negotiation - with runnable demos.

Dependency Injection and Hosting

  1. 129 Dependency Injection Learn dependency injection in C#: the idea, constructor injection, ServiceCollection, singleton, scoped and transient lifetimes, keyed services and captive dependencies.
  2. 130 Configuration and Options Learn .NET configuration: IConfiguration from memory and JSON, binding to classes, IOptions, IOptionsSnapshot, IOptionsMonitor, validation and environment layering.
  3. 131 Logging Learn logging in C# with Microsoft.Extensions.Logging - ILogger<T>, log levels, structured message templates, scopes, filtering, custom providers, LoggerMessage and common pitfalls.
  4. 132 The Generic Host and BackgroundService Learn the .NET Generic Host - Host.CreateApplicationBuilder, hosted services, BackgroundService, cancellation, graceful shutdown, lifetime events, scoped services in workers and worker patterns.
  5. 133 Caching and HttpClientFactory Learn in-memory caching with IMemoryCache - expiration, GetOrCreate, size limits, cache stampede - and typed HttpClients with IHttpClientFactory, handlers and resilience in .NET.

ASP.NET Core

  1. 134 ASP.NET Core Overview Meet ASP.NET Core - the app types (minimal APIs, MVC, Razor Pages, Blazor, SignalR, gRPC), Kestrel, WebApplication, the request pipeline - and run your first web server and call it with HttpClient.
  2. 135 Minimal APIs Build HTTP APIs with ASP.NET Core minimal APIs - MapGet, MapPost, MapPut, MapDelete, parameter binding, TypedResults, JSON, status codes, route groups and clean project organization.
  3. 136 Routing and Model Binding Understand ASP.NET Core routing and model binding - route templates, constraints, optional and catch-all segments, query, header, body and form binding, AsParameters, TryParse and BindAsync.
  4. 137 Middleware and the Request Pipeline Learn ASP.NET Core middleware in C# - the request pipeline, Use, Run and Map, ordering, short-circuiting, middleware classes, exception handling, request logging and endpoint filters.
  5. 138 Validation and Problem Details Validate input in C# web APIs with DataAnnotations, IValidatableObject and endpoint filters, and return consistent errors with ProblemDetails, ValidationProblem and IExceptionHandler.
  6. 139 Authentication and Authorization Understand authentication vs authorization in ASP.NET Core - claims, schemes, cookies vs JWT bearer tokens, policies, roles, 401 vs 403 and safe password hashing, with runnable C# demos.
  7. 140 REST API Design with ASP.NET Core Design clean REST APIs in ASP.NET Core - resource modeling, status codes, pagination, idempotency, versioning, ETags, OpenAPI documents and a pragmatic take on HATEOAS, with runnable C# examples.
  8. 141 MVC, Razor Pages and Blazor Compare ASP.NET Core MVC, Razor Pages, Blazor and minimal APIs - controllers, views, Razor syntax, tag helpers, model binding and validation, and how to choose, with runnable C# controller demos.
  9. 142 SignalR, WebSockets and gRPC Learn real-time communication in ASP.NET Core - long polling, Server-Sent Events, WebSockets, SignalR hubs on the wire and gRPC streaming - with runnable C# loopback demos and guidance on choosing.
  10. 143 Publishing and Deploying .NET Apps Learn how to publish a .NET app: framework-dependent vs self-contained, single-file, Native AOT, Docker, health checks, production configuration and graceful shutdown.
  11. 144 Health Checks and Rate Limiting Run ASP.NET Core in production with health checks (tags, degraded state, timeouts, JSON reports) and built-in rate limiting (fixed window, sliding window, token bucket, concurrency, per-client policies).
  12. 145 Blazor Components Learn Blazor components in depth - parameters, child content, lifecycle, EventCallback, cascading values, state containers and EditForm validation - with real Blazor components rendered by runnable C# code.
  13. 146 OpenAPI Docs and GraphQL Document ASP.NET Core APIs with OpenAPI and Swagger UI, then learn how GraphQL works - schemas, queries, resolvers, the N+1 problem and Hot Chocolate - with a runnable mini OpenAPI generator and GraphQL engine.
  14. 147 Resilience with Polly Build resilient .NET apps - transient faults, retry with backoff and jitter, timeouts, circuit breakers, hedging and fallbacks with Polly v8, plus runnable hand-written versions of each idea.

Data Access

  1. 148 Data Access in .NET A map of .NET data access: ADO.NET, micro-ORMs like Dapper and full ORMs like EF Core, how to choose, connection strings, and a runnable DataTable and mapper demo.
  2. 149 ADO.NET Concepts Learn ADO.NET in C#: connections, commands, DataReader, parameters against SQL injection, transactions, DataTable change tracking and DataView, with runnable demos.
  3. 150 Entity Framework Core Learn EF Core: DbContext, entities, migrations, how LINQ becomes SQL, change tracking, relationships, Include and N+1, with runnable stand-ins that show how it works.
  4. 151 Repositories, Unit of Work and Clean Architecture Understand the repository and unit of work patterns in C#, what EF Core already gives you, specifications, testing with fakes, and Clean Architecture dependencies, with runnable code.
  5. 152 Working with SQL and NoSQL from C# Real database work in C#: optimistic and pessimistic concurrency, isolation levels, retries and connection resilience, pagination, plus Redis and MongoDB basics with runnable models.

Testing and Quality

  1. 153 Testing Fundamentals Learn the basics of testing C# code - unit, integration and end-to-end tests, Arrange-Act-Assert, test doubles, test-driven development and a hand-written mini test runner you can run.
  2. 154 xUnit, NUnit and MSTest Compare the three .NET test frameworks - attributes, assertions, theories and data-driven tests, fixtures and lifecycle - with read-only real code and runnable stand-ins you can experiment with.
  3. 155 Mocks, Stubs and Fakes Learn test doubles in C# - interface seams, hand-written stubs, fakes and spies, faking time with TimeProvider, how Moq and NSubstitute work, a runnable mini mock, and how to avoid over-mocking.
  4. 156 Debugging and Diagnostics Learn to debug C# programs - breakpoints, reading stack traces, Debug.Assert, Trace listeners, caller info, Activity tracing, Meter metrics and the dotnet-counters, dotnet-trace and dotnet-dump tools.
  5. 157 Analyzers, Code Style and Warnings Learn how Roslyn analyzers, .editorconfig, warning severities, TreatWarningsAsErrors, nullable warnings and dotnet format keep C# code consistent and safe, with real compiler warnings you can run.
  6. 158 Design Patterns in C# Learn the design patterns C# developers use daily - strategy, observer, factory, builder, decorator, adapter, repository, singleton via DI and mediator - with short runnable examples and advice on when not to use them.
  7. 159 Secure C# Coding Write safer C# and ASP.NET Core code - stop SQL injection and XSS, validate paths, hash passwords, block CSRF with antiforgery tokens, keep secrets out of source and use Data Protection.
  8. 160 Integration Testing ASP.NET Core Test ASP.NET Core apps end to end with WebApplicationFactory - real routing, middleware and DI, replacing services and configuration, databases, authentication, and runnable examples.

Advanced C#

  1. 161 Source Generators and Roslyn Learn how C# source generators work: partial classes, GeneratedRegex, LoggerMessage, System.Text.Json, incremental generators, Roslyn syntax trees and when to write your own.
  2. 162 Native AOT, Trimming and Startup Understand Native AOT, IL trimming, ReadyToRun and tiered JIT in .NET: what each does, which C# code breaks (reflection), how to write trim-safe code and when AOT pays off.
  3. 163 Interop, COM and Native Code Call native C libraries from C#: P/Invoke, marshalling strings and structs, callbacks, function pointers, NativeLibrary, LibraryImport, error codes and the COM basics.
  4. 164 Pointers, stackalloc and Low-level Memory Go deep on low-level C#: ref locals, stackalloc, unsafe pointers, fixed buffers, InlineArray, the Unsafe and MemoryMarshal classes, endianness and the pitfalls to avoid.
  5. 165 IL, JIT and Tiered Compilation See what the C# compiler really emits: read IL with a mini disassembler, learn what lambdas, async and foreach become, and how the JIT, tiering, PGO and inlining work.
  6. 166 C# in Games and Desktop See how C# is used in games (Unity, Godot, MonoGame) and desktop apps (WPF, WinForms, MAUI): game loops, components, coroutines, ECS, GC pitfalls and MVVM, with runnable code.
  7. 167 INotifyPropertyChanged and MVVM Learn how data binding works in C# - INotifyPropertyChanged, a reusable base class, ObservableCollection, commands and validation - with a tiny binding engine you can run and step through.
  8. 168 Desktop and Mobile UI: WPF, WinForms, MAUI Compare the C# UI frameworks - WinForms, WPF, WinUI, .NET MAUI, Avalonia and Blazor Hybrid - and learn the shared ideas (UI thread, layout, XAML, binding) with runnable simulations and read-only samples.
  9. 169 Windows Forms Controls and Properties Learn the core ideas of C# Windows Forms - Form, Label, TextBox and Button properties, event handlers, layout and anchoring - with read-only WinForms code and runnable console stand-ins.

Projects

  1. 170 Project: Command-Line To-Do App Build a command-line to-do app in C# in four stages: records and LINQ, a command parser and menu loop, JSON persistence behind an interface, and a mini test suite with a fake clock.
  2. 171 Project: Bank Account System Build a bank in C# in four stages: decimal money and custom exceptions, account classes and events, atomic transfers behind one lock, and an audit log you can replay to prove the books balance.
  3. 172 Project: Inventory REST API Build an inventory REST API with ASP.NET Core minimal APIs in four stages: endpoints, dependency injection with validation, filters and problem details, then an automated HttpClient test suite.
  4. 173 Project: Text Adventure Engine Build a text adventure engine in C# in four stages: immutable game state with records, a list-pattern command parser, a pure step function with locked doors and darkness, then undo and tests.
  5. 174 Project: Log Analyzer Build a log analyzer in C# in four stages: a regex line parser, LINQ reports on thousands of entries, a zero-copy span parser, and a streaming pipeline for large and gzipped files.
  6. 175 Project: Background Job Queue Build a background job queue in C# in four stages: a bounded Channel with backpressure, retries with exponential backoff, a BackgroundService worker pool, and timeouts, shutdown and tests.
  7. 176 Project: Library Management System Build a library system in C# in three stages: books and members as classes with rules, borrowing and returning with fines, LINQ reports, and a console menu that runs a script of commands.
  8. 177 Project: Console Calculator Build an expression calculator in C# in three stages: a tokenizer, a recursive-descent parser with precedence, parentheses and functions, and clear error messages checked by a table of tests.

Practice and Review

  1. 178 C# Cheat Sheet A one-page C# 14 cheat sheet with tables for syntax, types, collections, LINQ, async and modern idioms, plus runnable snippets you can edit and test.
  2. 179 Practice Problems: Fundamentals Fifteen graded C# problems on types, control flow, strings, methods and collections. Every problem has a hint and a full solution with tests you can run.
  3. 180 Practice Problems: OOP, LINQ and Async Fifteen graded C# problems on classes, records, interfaces, events, generics, LINQ and async code, each with a hint and a complete runnable solution.
  4. 181 Data Structures from Scratch in C# Build a singly linked list and a binary search tree from scratch in C#, then solve classic array problems - rotation, duplicate removal and binary search in a rotated array - with tested code.
  5. 182 C# Interview Questions and Answers Fifty C# interview questions with concise answers and runnable examples: CLR, value vs reference types, GC, generics, LINQ, async, DI and ASP.NET Core.