using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Ninject; namespace NinjectDemo { class Program { static void Main(string[] args) { IKernel ninjectKernel = new StandardKernel(); ninjectKernel.Bind().To(); ninjectKernel.Bind().To(); // get the interface implementation IValueCalculator calcImp1 = ninjectKernel.Get(); // create the instance of ShoppingCart and inject the dependency ShoppingCart cart = new ShoppingCart(calcImp1); // perform the calculation and write out the result Console.WriteLine("Total: {0:c}", cart.CalculateStockValue()); } } public interface IDiscountHelper { decimal ApplyDiscount(decimal totalParam); } public class DefaultDiscountHelper : IDiscountHelper { public decimal ApplyDiscount(decimal totalParam) { return (totalParam - (10m / 100m * totalParam)); } } }