Ninject: What does it mean to bind something to itself?
问题 Ninject has the functionality of self binding like Bind<Samurai>().ToSelf(); I read about this but I don't get the importance or how this can be useful. Any comments are appreciated. 回答1: If Ninject finds a object that needs to be created and it has a constructor that has a Samurai parameter it does not know how to instantiate it. But when you use Bind<Samurai>().ToSelf(); then Ninject knows that a Samurai needs to be created to pass to the Samurai parameter. If that binding was not there