.NET coding patterns is a compact collection of practical implementation patterns for modern .NET development. Its examples focus on reusable techniques that arise when working with dependency injection, generics, configuration, services, and asynchronous networking. One section demonstrates using generic types as factories for resolving or creating services from an IServiceProvider. Other patterns cover lazy service initialization, exposing one implementation through multiple interfaces, caching singleton instances in generic types, and resolving dependencies with IOptions. The repository also includes a modern asynchronous socket server built with task-based accept, read, and write APIs. Examples are presented as focused Markdown explanations with C# code rather than as a single executable application. The project is intended as a reference for developers interested in concise, idiomatic .NET implementation techniques.
Features
- Generic types used as service factories
- Lazy dependency initialization patterns
- Multiple-interface service implementations
- Generic singleton caching techniques
- IServiceProvider and IOptions integration
- Task-based asynchronous socket server