本文整理汇总了C#中ShoppingCart.CalculateStockValue方法的典型用法代码示例。如果您正苦于以下问题:C# ShoppingCart.CalculateStockValue方法的具体用法?C# ShoppingCart.CalculateStockValue怎么用?C# ShoppingCart.CalculateStockValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShoppingCart
的用法示例。
在下文中一共展示了ShoppingCart.CalculateStockValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
// these statements are here so that we can generate
// results that display US currency values even though
// the locale of our machines is set to the UK
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US");
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
IKernel ninjectKernel = new StandardKernel();
//ninjectKernel.Bind<IValueCalculator>().To(typeof(LinqValueCalculator));
//ninjectKernel.Bind<IDiscountHelper>().To(typeof(DefaultDiscountHelper));
ninjectKernel.Bind<IValueCalculator>().To<LinqValueCalculator>();
ninjectKernel.Bind<IDiscountHelper>().To<DefaultDiscountHelper>();
// get the interface implementation
IValueCalculator calcImpl = ninjectKernel.Get<IValueCalculator>();
// create the instance of ShoppingCart and inject the dependency
ShoppingCart cart = new ShoppingCart(calcImpl);
// perform the calculation and write out the result
Console.WriteLine("Total: {0:c}", cart.CalculateStockValue());
}