C
C#2y ago
palapapa

✅ How does the implementation of `IServiceProvider.GetServices` work?

In https://source.dot.net/#Microsoft.Extensions.DependencyInjection.Abstractions/ServiceProviderServiceExtensions.cs,ed6b36f4cd78b748, you can see that it only calls GetRequiredService with IEnumerable<T>, which then calls GetService. There is nothing in the contract of IServiceProvider that says if you pass an IEnumerable<T> as the service type to GetService, it would return a IEnumerable of all registered services. Does this mean that GetServices only works with the internal implementation of IServiceProvider by MS?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?