0
那麼,問題:溫莎城堡能夠解決逆變類型嗎?
interface IControl<in T> where T : Base
{
void Execute(T item);
}
class ControlDerived : IControl<Derived>
{
public void Execute(Derived item)
{
}
}
class ControlBase : IControl<Base>
{
public void Execute(Base item)
{
}
}
class Derived : Base
{
}
是否有可能作出這樣溫莎工作:
var ctls = container.ResolveAll<IControl<Derived>>()
ctls.Lenght == 2 ?
所以我能得到兩種實現?
。不是嗎? – 2010-12-10 23:09:05