static SystemInfo[] getSortedSystemInfos(SystemInfo[] systemInfos, SortMethod sortMethod) { if (sortMethod == SortMethod.Name) { return systemInfos .OrderBy(systemInfo => systemInfo.systemName) .ToArray(); } if (sortMethod == SortMethod.NameDescending) { return systemInfos .OrderByDescending(systemInfo => systemInfo.systemName) .ToArray(); } if (sortMethod == SortMethod.ExecutionTime) { return systemInfos .OrderBy(systemInfo => systemInfo.averageExecutionDuration) .ToArray(); } if (sortMethod == SortMethod.ExecutionTimeDescending) { return systemInfos .OrderByDescending(systemInfo => systemInfo.averageExecutionDuration) .ToArray(); } return systemInfos; }