Specifying type when resolving objects through Ninject

Posted by stiank81 on Stack Overflow See other posts from Stack Overflow or by stiank81
Published on 2010-04-12T08:02:19Z Indexed on 2010/04/12 8:23 UTC
Read the original article Hit count: 460

Filed under:
|
|
|

Given the class Ninja, with a specified binding in the Ninject kernel I can resolve an object doing this:

var ninja = ninject.Get<Ninja>();

But why can't I do this:

Type ninjaType = typeof(Ninja); 
var ninja = ninject.Get<ninjaType>();

What's the correct way of specifying the type outside the call to Get?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#