Introduce FirstOrDefault extensions method for Array.Find and List.Find.
This allows the LINQ spelling to be used, but benefits from the performance improvement of the specific methods for these classes that provide the same result.
This commit is contained in:
@@ -305,7 +305,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// HACK: Use of this function requires that there is one squad of this type.
|
||||
Squad GetSquadOfType(SquadType type)
|
||||
{
|
||||
return Squads.Find(s => s.Type == type);
|
||||
return Squads.FirstOrDefault(s => s.Type == type);
|
||||
}
|
||||
|
||||
Squad RegisterNewSquad(IBot bot, SquadType type, (Actor Actor, WVec Offset) target = default)
|
||||
|
||||
Reference in New Issue
Block a user