Skip to content

Commit a23bd5c

Browse files
committed
Reduce allocations in InputSettings
1 parent 80789c6 commit a23bd5c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Source/ORTS.Settings/InputSettings.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class InputSettings : SettingsBase
6767

6868
public static readonly UserCommandInput[] DefaultCommands = new UserCommandInput[Enum.GetNames(typeof(UserCommand)).Length];
6969
public readonly UserCommandInput[] Commands = new UserCommandInput[Enum.GetNames(typeof(UserCommand)).Length];
70+
static readonly UserCommand[] UserCommandValues = (UserCommand[])Enum.GetValues(typeof(UserCommand));
7071

7172
static InputSettings()
7273
{
@@ -91,7 +92,7 @@ UserCommand GetCommand(string name)
9192

9293
UserCommand[] GetCommands()
9394
{
94-
return (UserCommand[])Enum.GetValues(typeof(UserCommand));
95+
return UserCommandValues;
9596
}
9697

9798
public override object GetDefaultValue(string name)

0 commit comments

Comments
 (0)