namespace Day19; public class Part { private readonly IDictionary _dict; public int X => _dict["x"]; public int M => _dict["m"]; public int S => _dict["s"]; public int A => _dict["a"]; public int Total => X + M + S + A; public Part(IDictionary dict) { if (string.Join(string.Empty, dict.Keys.Order()) != "amsx") { throw new ArgumentException("Expected dictionary with keys amsx", nameof(dict)); } _dict = dict; } public int Get(string property) { return _dict[property]; } public override string ToString() { return $"x = {X}, m = {M}, a = {A}, s = {S}, "; } }