.net 为什么ninject会在可以注入空枚举的地方注入null?

.net 为什么ninject会在可以注入空枚举的地方注入null?,.net,collections,ienumerable,ninject,.net,Collections,Ienumerable,Ninject,我有以下定义 interface IWeapon {} class Warrior { [Inject] public IEnumerable<IWeapon> Weapons { get; private set; } } 这一次,如果我调用new StandardKernel().Get()Ninject将抛出一个ActivationException,表示“没有匹配的绑定可用”。同样,我希望它只发送一个空的枚举 那么,这种行为真的是设计所期望的,还是存在缺陷?如果是设计

我有以下定义

interface IWeapon {}

class Warrior
{
 [Inject]
 public IEnumerable<IWeapon> Weapons { get; private set; }
}
这一次,如果我调用
new StandardKernel().Get()
Ninject将抛出一个ActivationException,表示“没有匹配的绑定可用”。同样,我希望它只发送一个空的枚举


那么,这种行为真的是设计所期望的,还是存在缺陷?如果是设计的,有什么解决办法吗?

我今天与Ian讨论了这个问题和构造函数评分。我们都同意我们应该改变这一点。耐心一点,等到我们实现它。

没有什么比直接从作者那里得到答案更重要的了。那我就等代码更改。或者我将尝试自己实施它。:)添加到最新版本。将是升级RC2的一部分。
class Warrior
{
    public IEnumerable<IWeapon> Weapons { get; private set; }

 public Warrior(IEnumerable<IWeapon> weapons)
 { this.Weapons = weapons; }
}