Creating a Singleton - How To Use Dependency Injection
An example in C# about how to create a singleton with support for dependency injection or inversion of control (IOC).
In-depth C# and .NET tutorials covering structured logging with Serilog, building Roslyn analyzers, NuGet packaging, and other core language and tooling topics.
Showing 259–264 of 264 articles
An example in C# about how to create a singleton with support for dependency injection or inversion of control (IOC).
Learn a reusable C# pattern for starting and stopping single or grouped worker threads using AutoResetEvent signals, locks, and ownership checks.
Compares the Thread and BackgroundWorker classes in .NET, explaining when each fits and how BackgroundWorker builds on Thread with its DoWork event.
Walk through a C# example showing how an EventHandler can pass data back through EventArgs between an application layer and a presentation layer.
A follow-up exploring how C# events help decouple layered architecture, using an import example to show delegating decisions between components.
Understand why C# events add flexibility to your architecture, letting components react to conditions instead of hardcoding rigid method call sequences.