using System.Collections.Generic;
public class Foo : IEquatable<Foo>
public string Fizz { get; set; } = default!;
public string Fuzz { get; set; } = default!;
public bool Equals(Foo? other) => other != null && (Fizz, Fuzz) == (other.Fizz, other.Fuzz);
public override bool Equals(object? obj) => Equals(obj as Foo);
public override int GetHashCode() => HashCode.Combine(Fizz, Fuzz);
public string Fizz { get; set; } = default!;
public string Fuzz { get; set; } = default!;
public static void Main()
var a = new Foo { Fizz = "Fizz", Fuzz = "Fuzz" };
var b = new Foo { Fizz = "Fizz", Fuzz = "Fuzz" };
var f = new Bar { Fizz = "Fizz", Fuzz = "Fuzz" };
var g = new Bar { Fizz = "Fizz", Fuzz = "Fuzz" };