using System.Data.Entity;
using System.Collections.Generic;
public static void Main()
var transactions = new List<ShopTransactionEntity>()
new ShopTransactionEntity(){
new ShopTransactionEntity(){
new ShopTransactionEntity(){
new ShopTransactionEntity(){
new ShopTransactionEntity(){
new ShopTransactionEntity(){
new ShopTransactionEntity(){
new ShopTransactionEntity(){
new ShopTransactionEntity(){
new ShopTransactionEntity(){
var query = transactions.GroupBy(t => new { t.Price, t.ItemId, t.CurrencyId }, t => t, (key, g) => new {key.ItemId, key.Price, key.CurrencyId, Quantity = g.Count()});
foreach (var transaction in query){
Console.WriteLine("ItemId: {0}, Price {1}, CurrencyId {2}, Quantity {3}", transaction.ItemId, transaction.Price, transaction.CurrencyId, transaction.Quantity);
public class ShopTransactionEntity
public int ItemId { get; set; }
public int Price { get; set; }
public int CurrencyId { get; set; }