How to inject dependencies in Collection form ??

Posted by Perpetualcoder on Stack Overflow See other posts from Stack Overflow or by Perpetualcoder
Published on 2010-04-22T06:46:20Z Indexed on 2010/04/22 9:03 UTC
Read the original article Hit count: 316

How do I wire up dependencies where the dependency is in the form of a collection ??

For Example:

public class Ninja {

public List<IShuriken> Shurikens {get;set;}
public IKatana Katana {get;set;}

public void Attack()
{
  // some code goes here to use weapons and kill people
}
}

How do i use a container like Ninject in a case like this ??

© Stack Overflow or respective owner

Related posts about dependency-injection

Related posts about inversion-of-control