diff --git a/Terminal.Gui/Types/PosDim.cs b/Terminal.Gui/Types/PosDim.cs index 7423c09c6..bf7fdf16c 100644 --- a/Terminal.Gui/Types/PosDim.cs +++ b/Terminal.Gui/Types/PosDim.cs @@ -311,6 +311,11 @@ namespace Terminal.Gui { { return $"Dim.Factor({factor})"; } + + public override int GetHashCode () => factor.GetHashCode(); + + public override bool Equals (object other) => other is DimFactor f && f.factor == factor; + } /// @@ -339,6 +344,11 @@ namespace Terminal.Gui { { return n; } + + public override int GetHashCode () => n.GetHashCode(); + + public override bool Equals (object other) => other is DimAbsolute abs && abs.n == n; + } class DimFill : Dim { @@ -353,7 +363,11 @@ namespace Terminal.Gui { internal override int Anchor (int width) { return width-margin; - } + } + + public override int GetHashCode () => margin.GetHashCode(); + + public override bool Equals (object other) => other is DimFill fill && fill.margin == margin; } static DimFill zeroMargin;