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:
@@ -515,7 +515,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
protected virtual void PauseProduction(string itemName, bool paused)
|
||||
{
|
||||
Queue.Find(a => a.Item == itemName)?.Pause(paused);
|
||||
Queue.FirstOrDefault(a => a.Item == itemName)?.Pause(paused);
|
||||
}
|
||||
|
||||
protected virtual void CancelProduction(string itemName, uint numberToCancel)
|
||||
|
||||
Reference in New Issue
Block a user