var kernel = new StandardKernel(); kernel.Load(new MyModule());
var kernel = new StandardKernel(); kernel.Bind().To (); var service = kernel.Get ();
public class MyClass { private IService _service; public MyClass(IService service) { _service = service; } public void DoSomething() { _service.Execute(); } } var kernel = new StandardKernel(); kernel.BindIn this example, the MyClass class has a constructor that takes an IService parameter. When the StandardKernel instance is configured to bind the IService interface to the MyService class, the MyClass instance can be created with the MyService implementation using the Get method. Then the DoSomething method can be invoked, which uses the injected MyService dependency to execute a method. Package library: Ninject Overall Package library: Ninject.().To (); var myClass = kernel.Get (); myClass.DoSomething();