Is there an easy way to sort a list on nullable values, by ascending, and put the null values at the end of the list ? Like an option or something
If not, which method would be the best between :
Write my own sort lambda
list.Sort((v1,v2) => { if (v1.HasValue && v2.HasValue) return v1.CommpareTo(v2); else if (!v1.HasValue) return -1; else if (!v2.HasValue) return 1; else return 0; })
Sort only the non-null values, and add null values after
list.Where(v => v.HasValue).OrderBy().AddRange(list.Where(v => !v.HasValue)