Removal of ToList()

This commit is contained in:
Brett Hewitson 2021-12-16 00:57:01 +10:00
parent 9f5cf132f0
commit 7af5f90e30
10 changed files with 48 additions and 42 deletions

View file

@ -452,8 +452,8 @@ namespace ServerManagerTool.Lib
{
try
{
var playerInfo = gameServer?.GetPlayers()?.Where(p => !string.IsNullOrWhiteSpace(p.Name?.Trim())).ToList();
var playerCount = playerInfo?.Count ?? -1;
var playerInfo = gameServer?.GetPlayers()?.Where(p => !string.IsNullOrWhiteSpace(p.Name?.Trim()));
var playerCount = playerInfo?.Count() ?? -1;
// check if anyone is logged into the server
if (playerCount <= 0)