考虑以下接口(interface)和类定义:publicinterfaceIInterface1{}publicinterfaceIInterface2{}publicclassMyClass:IInterface1,IInterface2{}有没有办法像这样用多个接口(interface)注册一个MyClass的实例:...services.AddSingleton();...并用像这样的不同接口(interface)解析MyClass的单个实例:IInterface1interface1=app.ApplicationServices.GetService();IInterface
考虑以下接口(interface)和类定义:publicinterfaceIInterface1{}publicinterfaceIInterface2{}publicclassMyClass:IInterface1,IInterface2{}有没有办法像这样用多个接口(interface)注册一个MyClass的实例:...services.AddSingleton();...并用像这样的不同接口(interface)解析MyClass的单个实例:IInterface1interface1=app.ApplicationServices.GetService();IInterface
我有接口(interface)IChild和IParent.IParent有一个成员是List.我希望有实现IParent的类每个类都有一个实现IChild的成员:publicinterfaceIChild{}publicinterfaceIParent{Lista{get;set;}}publicclassChildA:IChild{}publicclassChildB:IChild{}publicclassParentA:IParent{publicLista{get;set;}}publicclassParentB:IParent{publicLista{get;set;}}但是