- 
        Couldn't load subscription status. 
- Fork 5.2k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-Extensions-DependencyInjectionin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Description
Current workaround is to use the non-generic ObjectFactory and cast but that shouldn't be necessary.
ObjectFactory<A> a = ...;
ObjectFactory<B> b = ...;
ObjectFactory<Base> f = c ? a : b;
return f(...);API Proposal
namespace Microsoft.Extensions.DependencyInjection;
- public delegate T ObjectFactory<T>(IServiceProvider serviceProvider, object?[]? arguments);
+ public delegate T ObjectFactory<out T>(IServiceProvider serviceProvider, object?[]? arguments);Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-Extensions-DependencyInjectionin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged