Several answers are already sorting the last few numbers (which may be correct as you are showing an already sorted list). If you want the โunallocatedโ numbers to be displayed in the original, optionally sorted order instead of sorting, you can do this instead:
int num = 3; var result = list.Where(x => x == num).Concat(list.Where(x => x != num));
As @DuaneTheriot points out, the IEnumerable extension OrderBy method does stable sorting and does not reorder items that have the same key, in other words:
var result = list.OrderBy(x => x != 3);
works the same as sorting 3 first and preserving the order of all other elements.
Joachim Isaksson Mar 29 2018-12-12T00: 00Z
source share