Change type of `*Watch.ValidTypes`/`Watch.AvailableTypes` to list

This commit is contained in:
YoshiRulz 2025-06-15 02:46:53 +10:00
parent 822b105bd1
commit 51b7e914d2
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
5 changed files with 12 additions and 9 deletions

View File

@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
/// <summary>
/// Gets an enumeration of <see cref="WatchDisplayType"/> that are valid for a <see cref="ByteWatch"/>
/// </summary>
public static IEnumerable<WatchDisplayType> ValidTypes { get; } = [
public static readonly IReadOnlyList<WatchDisplayType> ValidTypes = [
WatchDisplayType.Unsigned,
WatchDisplayType.Signed,
WatchDisplayType.Hex,
@ -46,7 +46,7 @@ namespace BizHawk.Client.Common
/// Get a list a <see cref="WatchDisplayType"/> that can be used for this <see cref="ByteWatch"/>
/// </summary>
/// <returns>An enumeration that contains all valid <see cref="WatchDisplayType"/></returns>
public override IEnumerable<WatchDisplayType> AvailableTypes()
public override IReadOnlyList<WatchDisplayType> AvailableTypes()
{
return ValidTypes;
}

View File

@ -36,7 +36,7 @@ namespace BizHawk.Client.Common
/// <summary>
/// Gets a list of <see cref="WatchDisplayType"/> for a <see cref="DWordWatch"/>
/// </summary>
public static IEnumerable<WatchDisplayType> ValidTypes { get; } = [
public static readonly IReadOnlyList<WatchDisplayType> ValidTypes = [
WatchDisplayType.Unsigned,
WatchDisplayType.Signed,
WatchDisplayType.Hex,
@ -50,7 +50,7 @@ namespace BizHawk.Client.Common
/// Get a list of <see cref="WatchDisplayType"/> that can be used for a <see cref="DWordWatch"/>
/// </summary>
/// <returns>An enumeration that contains all valid <see cref="WatchDisplayType"/></returns>
public override IEnumerable<WatchDisplayType> AvailableTypes()
public override IReadOnlyList<WatchDisplayType> AvailableTypes()
{
return ValidTypes;
}

View File

@ -8,6 +8,8 @@ namespace BizHawk.Client.Common
/// </summary>
public sealed class SeparatorWatch : Watch
{
public static readonly IReadOnlyList<WatchDisplayType> ValidTypes = [ WatchDisplayType.Separator ];
/// <summary>
/// Initializes a new instance of the <see cref="SeparatorWatch"/> class.
/// </summary>
@ -33,8 +35,8 @@ namespace BizHawk.Client.Common
/// Get the appropriate WatchDisplayType
/// </summary>
/// <returns>WatchDisplayType.Separator nothing else</returns>
public override IEnumerable<WatchDisplayType> AvailableTypes()
=> [ WatchDisplayType.Separator ];
public override IReadOnlyList<WatchDisplayType> AvailableTypes()
=> ValidTypes;
/// <summary>
/// Ignore that stuff

View File

@ -252,7 +252,7 @@ namespace BizHawk.Client.Common
/// Gets a list a <see cref="WatchDisplayType"/> that can be used for this <see cref="Watch"/>
/// </summary>
/// <returns>An enumeration that contains all valid <see cref="WatchDisplayType"/></returns>
public abstract IEnumerable<WatchDisplayType> AvailableTypes();
public abstract IReadOnlyList<WatchDisplayType> AvailableTypes();
/// <summary>
/// Resets the previous value; set it to the current one

View File

@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
/// <summary>
/// Gets an Enumeration of <see cref="WatchDisplayType"/>s that are valid for a <see cref="WordWatch"/>
/// </summary>
public static IEnumerable<WatchDisplayType> ValidTypes { get; } = [
public static readonly IReadOnlyList<WatchDisplayType> ValidTypes = [
WatchDisplayType.Unsigned,
WatchDisplayType.Signed,
WatchDisplayType.Hex,
@ -47,7 +47,8 @@ namespace BizHawk.Client.Common
/// Get a list a <see cref="WatchDisplayType"/> that can be used for this <see cref="WordWatch"/>
/// </summary>
/// <returns>An enumeration that contains all valid <see cref="WatchDisplayType"/></returns>
public override IEnumerable<WatchDisplayType> AvailableTypes() => ValidTypes;
public override IReadOnlyList<WatchDisplayType> AvailableTypes()
=> ValidTypes;
/// <summary>
/// Reset the previous value; set it to the current one