Use Array.Find and List.Find instead of LINQ's FirstOrDefault

This commit is contained in:
abcdefg30
2023-10-30 16:14:10 +01:00
committed by Gustas
parent 48a2a75211
commit 57cef527ba
2 changed files with 2 additions and 2 deletions

View File

@@ -206,7 +206,7 @@ namespace OpenRA.Mods.Common.Lint
if (translatables.ContainsKey(nodeType))
{
var childType = childNode.Key.Split('@')[0];
var field = translatables[nodeType].FirstOrDefault(t => t.Name == childType);
var field = Array.Find(translatables[nodeType], t => t.Name == childType);
if (field.Name == null)
continue;

View File

@@ -505,7 +505,7 @@ namespace OpenRA.Mods.D2k.UtilityCommands
}
// Get the first tileset template that contains the Frame ID of the original map's tile with the requested index
var template = tileSetsFromYaml.FirstOrDefault(x => ((DefaultTerrainTemplateInfo)x).Frames.Contains(tileIndex));
var template = tileSetsFromYaml.Find(x => ((DefaultTerrainTemplateInfo)x).Frames.Contains(tileIndex));
// HACK: The arrakis.yaml tileset file seems to be missing some tiles, so just get a replacement for them
// Also used for duplicate tiles that are taken from only tileset