Avoid multiple enumeration by converting to array at construction time

This commit is contained in:
Dean Herbert 2020-11-12 10:55:22 +09:00
parent b28a0d5cd5
commit ad79c2bc62
1 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ namespace osu.Game
internal class PerformFromMenuRunner : Component
{
private readonly Action<IScreen> finalAction;
private readonly IEnumerable<Type> validScreens;
private readonly Type[] validScreens;
private readonly Func<IScreen> getCurrentScreen;
[Resolved]
@ -53,7 +53,7 @@ public PerformFromMenuRunner(Action<IScreen> finalAction, IEnumerable<Type> 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));