I can think of a million ways to do this, but none seem very elegant. I wonder if anyone knows a neat way to move an item of say id=10 as the first item in a list using LINQ (or whatever really)
Item A - id =5 Item B - id = 10 Item C - id =12 Item D - id =1
In this case how can I elegantly move Item C to the top of my List?
This is the best I have right now...
var allCountries = repository.GetCountries(); var topitem = allCountries.Single(x => x.id == 592); var finalList = new List<Country>(); finalList.Add(topitem); finalList = finalList.Concat(allCountries.Where(x=> x.id != 592)).ToList();