C# guides
Every published C# guide, newest first, with practical examples you can copy into your own project.
3,965 guides across 14 topics
Topics
Popular C# guides
Most readLatest C# guides
Page 1 of 77NuGet NU1101: unable to find the package in any source
The package is not on any feed this solution queries. Check the inherited source list first, then authentication.
.NET DI: Unable to resolve service for type while attempting to activate
Read the two type names in order, then check registration, namespace and lifetime. Includes the scoped-into-singleton follow-on error.
dotnet: A compatible .NET SDK was not found (global.json)
The message names the file and the missing band. Relax rollForward, pin an installed version, or remove the second pin in CI.
EF Core: A second operation was started on this context instance
A DbContext is not thread-safe. Sequence the work, split it across factories, and stop capturing scoped contexts in background tasks.
CS8618: Non-nullable property must contain a non-null value
Nullable reference types caught a promise the constructor does not keep. Choose required, a constructor parameter, an honest string? or a documented null-forgiving default.
CS0219: The Variable Is Assigned but Its Value Is Never Used
Roslyn reports CS0219 only for locals whose assigned value is dead and side-effect free. How to tell a leftover from a forgotten return, and where to suppress it.
C# 12 Collection Expressions: Syntax, Spread Operator, and Performance
How C# 12 collection expressions convert to arrays, spans, lists, and builder-backed types, and where the spread element and target-type rules decide performance.
C# Primary Constructors: Syntax, Scope, and Pitfalls
How C# 12 primary constructors work on classes and structs, what the compiler generates, and the property, capture, and validation pitfalls that surprise teams.
C# using vs Dispose: When to Use Each
Understand the difference between C#'s using statement and calling Dispose directly, with practical guidance for IDisposable cleanup and exception safety.
C# Dispose vs Destructor: Key Differences Explained
Dispose runs when you call it; a destructor runs later on the finalizer thread. The Dispose(bool) pattern, double-dispose guards, and when to skip one.