From 79997cea066be95dd183157fb2426ce372ff669c Mon Sep 17 00:00:00 2001 From: Brandon Thetford Date: Thu, 15 Feb 2024 18:42:17 -0700 Subject: [PATCH] Turn this into a record struct --- Terminal.Gui/Drawing/Attribute.cs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/Terminal.Gui/Drawing/Attribute.cs b/Terminal.Gui/Drawing/Attribute.cs index 4afba6aee..fd5897fad 100644 --- a/Terminal.Gui/Drawing/Attribute.cs +++ b/Terminal.Gui/Drawing/Attribute.cs @@ -11,7 +11,7 @@ namespace Terminal.Gui; /// class to define color schemes that can be used in an application. /// [JsonConverter (typeof (AttributeJsonConverter))] -public readonly struct Attribute : IEquatable, IEqualityOperators +public readonly record struct Attribute : IEqualityOperators { /// Default empty attribute. public static readonly Attribute Default = new (Color.White, ColorName.Black); @@ -107,21 +107,6 @@ public readonly struct Attribute : IEquatable, IEqualityOperatorsThe color. public Attribute (in Color color) : this (color, color) { } - /// Compares two attributes for equality. - /// - /// - /// - public static bool operator == (Attribute left, Attribute right) { return left.Equals (right); } - - /// Compares two attributes for inequality. - /// - /// - /// - public static bool operator != (Attribute left, Attribute right) { return !(left == right); } - - /// - public override bool Equals (object? obj) { return obj is Attribute other && Equals (other); } - /// public bool Equals (Attribute other) { return PlatformColor == other.PlatformColor && Foreground == other.Foreground && Background == other.Background; }