this is my interfaces and classes:
public interface IWeapon
{
void Shoot();
}
public interface IWarrior
{
void Kill();
}
public class Killer : IWarrior
{
private static IWeapon _weapon;
public void Kill()
{
_weapon.Shoot();
}
}
public class Rifle : IWeapon
{
public void Shoot()
{
}
}
How I can inject Rifle in Killer class with Ninject?
Ninject does not inject statics because this should be done using InSingletonScope. It does not support field injection too, because fields should not be accessed from outside a class. Use constructor or property injection instead.