using System;
using System.Linq;
using System.Collections.Generic;
public class Test
{
public static void Main()
{
var rose = new Fact { Thing = "Roses are", Color = 0xFF0000 };
var violet = new Fact { Thing = "Violets are", Color = 0x0000FF };
var sugar = new Fact { Thing = "Sugar is", Color = 0x1337 };
var list = new List<Fact> () {
rose, rose, violet, sugar, sugar
};
foreach (var item in list.Distinct()) {
Console.WriteLine ("{0:x} {1:x}", item.Thing, item.Color);
}
}
}
public class Fact
{
public string Thing { get; set; }
public int Color { get; set; }
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uTGlucTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWM7CiAKcHVibGljIGNsYXNzIFRlc3QKewogICAgICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkKICAgICAgICB7CiAgICAgICAgICAgICAgICB2YXIgcm9zZSA9IG5ldyBGYWN0IHsgVGhpbmcgPSAiUm9zZXMgYXJlIiwgQ29sb3IgPSAweEZGMDAwMCB9OwogICAgICAgICAgICAgICAgdmFyIHZpb2xldCA9IG5ldyBGYWN0IHsgVGhpbmcgPSAiVmlvbGV0cyBhcmUiLCBDb2xvciA9IDB4MDAwMEZGIH07CiAgICAgICAgICAgICAgICB2YXIgc3VnYXIgPSBuZXcgRmFjdCB7IFRoaW5nID0gIlN1Z2FyIGlzIiwgQ29sb3IgPSAweDEzMzcgfTsKIAogICAgICAgICAgICAgICAgdmFyIGxpc3QgPSBuZXcgTGlzdDxGYWN0PiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcm9zZSwgcm9zZSwgdmlvbGV0LCBzdWdhciwgc3VnYXIKICAgICAgICAgICAgICAgIH07CiAKICAgICAgICAgICAgICAgIGZvcmVhY2ggKHZhciBpdGVtIGluIGxpc3QuRGlzdGluY3QoKSkgewogICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lICgiezA6eH0gezE6eH0iLCBpdGVtLlRoaW5nLCBpdGVtLkNvbG9yKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICB9Cn0KIAogCnB1YmxpYyBjbGFzcyBGYWN0CnsKICAgIHB1YmxpYyBzdHJpbmcgVGhpbmcgeyBnZXQ7IHNldDsgfQogICAgcHVibGljIGludCBDb2xvciB7IGdldDsgc2V0OyB9Cn0=