using System.Collections.Generic;
public string Code { get; }
public MyKey(string code) => Code = code ?? throw new ArgumentNullException("code");
public override int GetHashCode() => Code.GetHashCode();
public static void Main1(string[] args)
var myMap = new Dictionary<MyKey, string>();
var key = new MyKey("KeyA");
myMap.Add(key, "Value1");
myMap.Add(key, "Value2");
myMap.Remove(new MyKey("KeyB"));
Console.WriteLine($"size = {myMap.Count}");