Browse Source

Turn this into a record struct

Brandon Thetford 1 year ago
parent
commit
79997cea06
1 changed files with 1 additions and 16 deletions
  1. 1 16
      Terminal.Gui/Drawing/Attribute.cs

+ 1 - 16
Terminal.Gui/Drawing/Attribute.cs

@@ -11,7 +11,7 @@ namespace Terminal.Gui;
 ///     <see cref="ColorScheme"/> class to define color schemes that can be used in an application.
 /// </remarks>
 [JsonConverter (typeof (AttributeJsonConverter))]
-public readonly struct Attribute : IEquatable<Attribute>, IEqualityOperators<Attribute, Attribute, bool>
+public readonly record struct Attribute : IEqualityOperators<Attribute, Attribute, bool>
 {
     /// <summary>Default empty attribute.</summary>
     public static readonly Attribute Default = new (Color.White, ColorName.Black);
@@ -107,21 +107,6 @@ public readonly struct Attribute : IEquatable<Attribute>, IEqualityOperators<Att
     /// <param name="color">The color.</param>
     public Attribute (in Color color) : this (color, color) { }
 
-    /// <summary>Compares two attributes for equality.</summary>
-    /// <param name="left"></param>
-    /// <param name="right"></param>
-    /// <returns></returns>
-    public static bool operator == (Attribute left, Attribute right) { return left.Equals (right); }
-
-    /// <summary>Compares two attributes for inequality.</summary>
-    /// <param name="left"></param>
-    /// <param name="right"></param>
-    /// <returns></returns>
-    public static bool operator != (Attribute left, Attribute right) { return !(left == right); }
-
-    /// <inheritdoc/>
-    public override bool Equals (object? obj) { return obj is Attribute other && Equals (other); }
-
     /// <inheritdoc/>
     public bool Equals (Attribute other) { return PlatformColor == other.PlatformColor && Foreground == other.Foreground && Background == other.Background; }