using System.Collections.Generic;
public static void Main()
List<Block> blocks = new List<Block> ();
var new_blocks = blocks.GroupBy(x=>
id_material = x.Key.id_material,
id_color = x.Key.id_color,
weight = x.Sum(y => y.weight)
foreach(var item in new_blocks)
Console.WriteLine($"{item.id_material},{item.id_color},{item.weight}");
public int id_material { get; set; }
public int id_color { get; set; }
public float weight { get; set; }