6.1.5: e.g. 6.13 Using Ninject Self-Binding

chap6
Jason Zhu 2021-08-10 23:04:15 +10:00
parent ebb1840db9
commit bf4277e47e
1 changed files with 1 additions and 1 deletions

View File

@ -22,7 +22,7 @@ namespace NinjectDemo
// get the interface implementation
IValueCalculator calcImp1 = ninjectKernel.Get<IValueCalculator>();
// create the instance of ShoppingCart and inject the dependency
ShoppingCart cart = new ShoppingCart(calcImp1);
ShoppingCart cart = ninjectKernel.Get<ShoppingCart>();
// perform the calculation and write out the result
Console.WriteLine("Total: {0:c}", cart.CalculateStockValue());
}