To create a named bindings, use this syntax:

var n1 = new Test();
var n2 = new Test();

const string name1 = "name1";
const string name2 = "name2";

//Create container.
var injector = new MugenInjector();
injector.Bind<ITest>().ToConstant(n1).NamedBinding(name1);
injector.Bind<ITest>().ToConstant(n2).NamedBinding(name2);

Debug.Assert(injector.Get<ITest>(name1) == n1);
Debug.Assert(injector.Get<ITest>(name2) == n2);

Last edited Apr 16, 2012 at 5:42 PM by VVS0205, version 1

Comments

No comments yet.