Skip to content

harunmarangoz/dotnet-keyed-services-examples

Repository files navigation

🔑 .NET Keyed Services Examples

This repository contains examples and usage scenarios of the new Keyed Services feature introduced in .NET 8.

🚀 What are Keyed Services?

In some cases, you may need to register multiple implementations of the same interface and choose between them depending on the context. While factory patterns or IEnumerable<T> injection were common solutions in the past, Keyed Services now provide a cleaner, built-in way to achieve this.

With Keyed Services, you can register services using a key, and later inject or resolve them based on that key.

✅ Key types supported:

  • string
  • enum
  • Type
  • custom objects (e.g. record, struct, class)

Examples:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages