diff --git a/Terminal.Gui/Core/ConsoleDriver.cs b/Terminal.Gui/Core/ConsoleDriver.cs index 0f9174665..4f5bf06b3 100644 --- a/Terminal.Gui/Core/ConsoleDriver.cs +++ b/Terminal.Gui/Core/ConsoleDriver.cs @@ -314,11 +314,17 @@ namespace Terminal.Gui { return attribute; } + /// public override bool Equals (object obj) { return Equals (obj as ColorScheme); } + /// + /// Compares two objects for equality. + /// + /// + /// true if the two objects are equal public bool Equals (ColorScheme other) { return other != null && @@ -329,6 +335,7 @@ namespace Terminal.Gui { EqualityComparer.Default.Equals (_disabled, other._disabled); } + /// public override int GetHashCode () { int hashCode = -1242460230; @@ -340,11 +347,23 @@ namespace Terminal.Gui { return hashCode; } + /// + /// Compares two objects for equality. + /// + /// + /// + /// true if the two objects are equivalent public static bool operator == (ColorScheme left, ColorScheme right) { return EqualityComparer.Default.Equals (left, right); } + /// + /// Compares two objects for inequality. + /// + /// + /// + /// true if the two objects are not equivalent public static bool operator != (ColorScheme left, ColorScheme right) { return !(left == right); @@ -360,8 +379,8 @@ namespace Terminal.Gui { // Use reflection to dynamically create the default set of ColorSchemes from the list defiined // by the class. ColorSchemes = typeof (Colors).GetProperties () - .Where(p => p.PropertyType == typeof(ColorScheme)) - .Select (p => new KeyValuePair (p.Name, new ColorScheme())) // (ColorScheme)p.GetValue (p))) + .Where (p => p.PropertyType == typeof (ColorScheme)) + .Select (p => new KeyValuePair (p.Name, new ColorScheme ())) // (ColorScheme)p.GetValue (p))) .ToDictionary (t => t.Key, t => t.Value); } @@ -413,9 +432,9 @@ namespace Terminal.Gui { /// This API will be deprecated in the future. Use instead (e.g. edit.ColorScheme = Colors.ColorSchemes["Error"]; /// /// - public static ColorScheme Error { get => GetColorScheme (); set => SetColorScheme (value); } + public static ColorScheme Error { get => GetColorScheme (); set => SetColorScheme (value); } - static ColorScheme GetColorScheme([CallerMemberName] string callerMemberName = null) + static ColorScheme GetColorScheme ([CallerMemberName] string callerMemberName = null) { return ColorSchemes [callerMemberName]; }