From 3f0159cd894dd56717b75e09fbc9cbdce47c94b5 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Mon, 30 Oct 2023 16:12:43 +0100 Subject: [PATCH] Index at 0 instead of using LINQ's First --- OpenRA.Game/FieldLoader.cs | 2 +- OpenRA.Mods.Common/Lint/CheckTranslationReference.cs | 2 +- OpenRA.Platforms.Default/Sdl2PlatformWindow.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/FieldLoader.cs b/OpenRA.Game/FieldLoader.cs index 60cf702b18..c8f8602027 100644 --- a/OpenRA.Game/FieldLoader.cs +++ b/OpenRA.Game/FieldLoader.cs @@ -531,7 +531,7 @@ namespace OpenRA if (string.IsNullOrEmpty(value)) return null; - var innerType = fieldType.GetGenericArguments().First(); + var innerType = fieldType.GetGenericArguments()[0]; var innerValue = GetValue("Nullable", innerType, value, field); return fieldType.GetConstructor(new[] { innerType }).Invoke(new[] { innerValue }); } diff --git a/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs b/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs index 58e9e465f7..36f029c532 100644 --- a/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs +++ b/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs @@ -144,7 +144,7 @@ namespace OpenRA.Mods.Common.Lint .Where(t => t.Value.Length > 0) .ToDictionary( t => t.Key, - t => t.Value.Select(f => (f.Name, f, Utility.GetCustomAttributes(f, true).First())).ToArray()); + t => t.Value.Select(f => (f.Name, f, Utility.GetCustomAttributes(f, true)[0])).ToArray()); foreach (var filename in modData.Manifest.ChromeLayout) { diff --git a/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs b/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs index 2ae2a07498..606df843f2 100644 --- a/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs +++ b/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs @@ -160,7 +160,7 @@ namespace OpenRA.Platforms.Default throw new InvalidOperationException("No supported OpenGL profiles were found."); } - profile = supportedProfiles.Contains(requestProfile) ? requestProfile : supportedProfiles.First(); + profile = supportedProfiles.Contains(requestProfile) ? requestProfile : supportedProfiles[0]; // Note: This must be called after the CanCreateGLWindow checks above, // which needs to create and destroy its own SDL contexts as a workaround for specific buggy drivers