With a collection of Rules I am trying to create another collection of Rules ignoring the Site property and creating a unique list.
public class Rule
{
    public int TestId { get; set; }
    public string File { get; set; }
    public string Site { get; set; }
    public string[] Columns { get; set; }
}
So if my collection had values like below:
var rules = new List<Rule>
{
    new Rule { TestId = 1, File = "Foo", Site = "SiteA", Columns = new string[] { "ColA", "ColB" }},
    new Rule { TestId = 1, File = "Foo", Site = "SiteB", Columns = new string[] { "ColA", "ColB" }}
};
I am wanting the end result
var uniqueRules = new List<Rule>
{
    new Rule { TestId = 1, File = "Foo", Site = null, Columns = new string[] { "ColA", "ColB" }}
};
Having tried various combinations like below I'm still getting 2 results back, how do I achieve the expected result?
var uniqueRules = rules
    .GroupBy(r => new { r.TestId, r.File, r.Columns })
    .Select(g => g.Key)
    .Distinct()
    .ToList();
 
     
     
     
    