From ad79c2bc6286c377dd2c8757abb7fa18a7f81454 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 Nov 2020 10:55:22 +0900 Subject: [PATCH] Avoid multiple enumeration by converting to array at construction time --- osu.Game/PerformFromMenuRunner.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/PerformFromMenuRunner.cs b/osu.Game/PerformFromMenuRunner.cs index 8fcea7c277..9afe87f74f 100644 --- a/osu.Game/PerformFromMenuRunner.cs +++ b/osu.Game/PerformFromMenuRunner.cs @@ -20,7 +20,7 @@ namespace osu.Game internal class PerformFromMenuRunner : Component { private readonly Action finalAction; - private readonly IEnumerable validScreens; + private readonly Type[] validScreens; private readonly Func getCurrentScreen; [Resolved] @@ -53,7 +53,7 @@ public PerformFromMenuRunner(Action finalAction, IEnumerable vali validScreens = validScreens.Append(typeof(MainMenu)); this.finalAction = finalAction; - this.validScreens = validScreens; + this.validScreens = validScreens.ToArray(); this.getCurrentScreen = getCurrentScreen; Scheduler.Add(task = new ScheduledDelegate(checkCanComplete, 0, 200));