コード例 #1
0
        private void GroupByPrice()
        {
            Dictionary <int, decimal> values = GetPrices();
            var priceGroups =
                from pair in values
                group pair.Key by Purchases.EvaluatePrice((int)pair.Value)//checking if they are expsnive or cheap or maybe midrange
                into priceGroup
                orderby priceGroup.Key descending
                select priceGroup;

            foreach (var group in priceGroups)
            {
                string message = String.Format("Found {0} {1} komiksow numery ", group.Count(), group.Key.ToString());

                foreach (var issue in group)
                {//creating new objects on result
                    message += issue.ToString() + " ";
                    CurrenQueryResults.Add(CreateAnonymousListViewItem(message)
                                           );
                }
            }
        }