public string PrintBill <I>(IEnumerable <I> items, IItemSorter <I> sorter) where I : IItem { string bill = ""; foreach (var item in sorter.SortItems(items)) { bill += String.Format( "towar {0} : cena {1} + podatek {2}\n", item.Name, item.Price, taxCalc.CalculateTax(item.Price) ); } return(bill); }
public void PrintBill(Item[] Items, IItemSorter itemSorter) { Item[] sortedItems = Items; if (itemSorter != null) { itemSorter.SortItems(sortedItems); } Console.WriteLine("Wartość podatku {0}", Tax); foreach (var item in sortedItems) { Console.WriteLine("towar {0} : cena {1} + podatek {2}", item.Name, item.Price, taxCalc.CalculateTax(item.Price)); } }