From 51b7e914d25ca90133aac55dc8f5693b168c6f9d Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sun, 15 Jun 2025 02:46:53 +1000 Subject: [PATCH] Change type of `*Watch.ValidTypes`/`Watch.AvailableTypes` to list --- src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs | 4 ++-- src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs | 4 ++-- src/BizHawk.Client.Common/tools/Watch/SeparatorWatch.cs | 6 ++++-- src/BizHawk.Client.Common/tools/Watch/Watch.cs | 2 +- src/BizHawk.Client.Common/tools/Watch/WordWatch.cs | 5 +++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs b/src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs index 5aacf977ae..13b4dc3412 100644 --- a/src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs +++ b/src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs @@ -35,7 +35,7 @@ namespace BizHawk.Client.Common /// /// Gets an enumeration of that are valid for a /// - public static IEnumerable ValidTypes { get; } = [ + public static readonly IReadOnlyList ValidTypes = [ WatchDisplayType.Unsigned, WatchDisplayType.Signed, WatchDisplayType.Hex, @@ -46,7 +46,7 @@ namespace BizHawk.Client.Common /// Get a list a that can be used for this /// /// An enumeration that contains all valid - public override IEnumerable AvailableTypes() + public override IReadOnlyList AvailableTypes() { return ValidTypes; } diff --git a/src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs b/src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs index f64bd59639..da9214a390 100644 --- a/src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs +++ b/src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs @@ -36,7 +36,7 @@ namespace BizHawk.Client.Common /// /// Gets a list of for a /// - public static IEnumerable ValidTypes { get; } = [ + public static readonly IReadOnlyList ValidTypes = [ WatchDisplayType.Unsigned, WatchDisplayType.Signed, WatchDisplayType.Hex, @@ -50,7 +50,7 @@ namespace BizHawk.Client.Common /// Get a list of that can be used for a /// /// An enumeration that contains all valid - public override IEnumerable AvailableTypes() + public override IReadOnlyList AvailableTypes() { return ValidTypes; } diff --git a/src/BizHawk.Client.Common/tools/Watch/SeparatorWatch.cs b/src/BizHawk.Client.Common/tools/Watch/SeparatorWatch.cs index 50497f3e7d..7bec65af71 100644 --- a/src/BizHawk.Client.Common/tools/Watch/SeparatorWatch.cs +++ b/src/BizHawk.Client.Common/tools/Watch/SeparatorWatch.cs @@ -8,6 +8,8 @@ namespace BizHawk.Client.Common /// public sealed class SeparatorWatch : Watch { + public static readonly IReadOnlyList ValidTypes = [ WatchDisplayType.Separator ]; + /// /// Initializes a new instance of the class. /// @@ -33,8 +35,8 @@ namespace BizHawk.Client.Common /// Get the appropriate WatchDisplayType /// /// WatchDisplayType.Separator nothing else - public override IEnumerable AvailableTypes() - => [ WatchDisplayType.Separator ]; + public override IReadOnlyList AvailableTypes() + => ValidTypes; /// /// Ignore that stuff diff --git a/src/BizHawk.Client.Common/tools/Watch/Watch.cs b/src/BizHawk.Client.Common/tools/Watch/Watch.cs index f1f0d24e35..a1a069492f 100644 --- a/src/BizHawk.Client.Common/tools/Watch/Watch.cs +++ b/src/BizHawk.Client.Common/tools/Watch/Watch.cs @@ -252,7 +252,7 @@ namespace BizHawk.Client.Common /// Gets a list a that can be used for this /// /// An enumeration that contains all valid - public abstract IEnumerable AvailableTypes(); + public abstract IReadOnlyList AvailableTypes(); /// /// Resets the previous value; set it to the current one diff --git a/src/BizHawk.Client.Common/tools/Watch/WordWatch.cs b/src/BizHawk.Client.Common/tools/Watch/WordWatch.cs index f5fd8c0ae9..1220b3f298 100644 --- a/src/BizHawk.Client.Common/tools/Watch/WordWatch.cs +++ b/src/BizHawk.Client.Common/tools/Watch/WordWatch.cs @@ -35,7 +35,7 @@ namespace BizHawk.Client.Common /// /// Gets an Enumeration of s that are valid for a /// - public static IEnumerable ValidTypes { get; } = [ + public static readonly IReadOnlyList ValidTypes = [ WatchDisplayType.Unsigned, WatchDisplayType.Signed, WatchDisplayType.Hex, @@ -47,7 +47,8 @@ namespace BizHawk.Client.Common /// Get a list a that can be used for this /// /// An enumeration that contains all valid - public override IEnumerable AvailableTypes() => ValidTypes; + public override IReadOnlyList AvailableTypes() + => ValidTypes; /// /// Reset the previous value; set it to the current one