本文整理汇总了C#中Store.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Store.Add方法的具体用法?C# Store.Add怎么用?C# Store.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main()
{
var store = new Store ();
//Handling the event
store.ProductAdded += OnProductAdded;
store.Add (new Product ());
}
示例2: Main
static void Main(string[] args)
{
var store = new Store();
store.Add<Egg>(999);
store.Add<Bread>(999);
var shopper = new ThisPoorGuy(12000, store);
var wife = shopper.Wife;
Console.WriteLine(shopper.Funds);
wife.DemandEggs(12);
Console.WriteLine("Store has {0} eggs, shopper has {1} eggs, shopper has {2} funds. Shopper's cart is worth {3}",
store.Items.Count(i => i is Egg), shopper.Cart.Items.Count(i => i is Egg),
shopper.Funds, shopper.Cart.Value);
Console.ReadLine();
}