Optimize IsLoaded<T>

can we get rid of the other 3 functions maybe?
This commit is contained in:
Morilli 2024-03-26 18:32:32 +01:00
parent 3c2b01f34b
commit 45159091e6
1 changed files with 1 additions and 1 deletions

View File

@ -441,7 +441,7 @@ namespace BizHawk.Client.EmuHawk
/// <typeparam name="T">Type of tool to check</typeparam>
/// <remarks>yo why do we have 4 versions of this, each with slightly different behaviour in edge cases --yoshi</remarks>
public bool IsLoaded<T>() where T : IToolForm
=> _tools.OfType<T>().FirstOrDefault()?.IsActive is true;
=> _tools.Find(static t => t is T)?.IsActive is true;
public bool IsLoaded(Type toolType)
=> _tools.Find(t => t.GetType() == toolType)?.IsActive is true;