using System.Collections.Generic;
public static void Main()
var ringings = new List<Ringing>();
MacAddress = new byte[] { 0x12, 0x34 },
MacAddress = new byte[] { 0x12, 0x34 },
MacAddress = new byte[] { 0x56, 0x78 },
MacAddress = new byte[] { 0x56, 0x78 },
Console.WriteLine("Grouped by Id Results:");
var byId = ringings.GroupBy(x => x.Id).Select(x => x.OrderBy(y => y.Rssi).First());
foreach (var byIdItem in byId)
Console.WriteLine(byIdItem.Id + " | " + byIdItem.Rssi + " | " + BitConverter.ToString(byIdItem.MacAddress));
Console.WriteLine("Grouped by MacAddress Results:");
var byMac = ringings.GroupBy(x => BitConverter.ToString(x.MacAddress)).Select(x => x.OrderBy(y => y.Rssi).First());
foreach (var byMacItem in byMac)
Console.WriteLine(byMacItem.Id + " | " + byMacItem.Rssi + " | " + BitConverter.ToString(byMacItem.MacAddress));
public int Id { get; set; }
public int Rssi { get; set; }
public byte[] MacAddress { get; set; }