Having a List<Office>
where Office is a class, I have to sort its entries by country (where country is a property of class Office).
Some offices have no country set and therefore will be displayed at the top of the list. In this case I have to put them at the bottom of the list since considered "less relevant".
switch (sortOptions.SortField)
...
case OfficeSortField.Country:
var noCountryList = officesList.Where(a => string.IsNullOrEmpty(a.CountryText)).ToList();
officesList.RemoveAll(a => string.IsNullOrEmpty(a.CountryText));
officesList= sortOptions.SortOrder == SortOrder.Ascending
? officesList.OrderBy(o => o.CountryText).ToList()
: officesList.OrderByDescending(o => o.CountryText).ToList();
officesList.AddRange(noCountryAssoList);
break;
Under perfomance perspective, is there a better way to proceed?