Added MinBy, MaxBy, MinByOrDefault and MaxByOrDefault methods and replaced calls of the style OrderBy[Descending]().First[OrDefault]() which is not as performant.

This commit is contained in:
RoosterDragon
2014-05-22 01:30:48 +01:00
parent db08357e36
commit 0ea3509ee4
16 changed files with 90 additions and 47 deletions

View File

@@ -535,7 +535,7 @@ namespace OpenRA.Server
LobbyInfo.Clients.RemoveAll(c => c.Bot != null && c.BotControllerClientIndex == toDrop.PlayerIndex);
var nextAdmin = LobbyInfo.Clients.Where(c1 => c1.Bot == null)
.OrderBy(c => c.Index).FirstOrDefault();
.MinByOrDefault(c => c.Index);
if (nextAdmin != null)
{