c# - Order a list with unique rows with a given row as first item, then reorder the list but without the first row -
c# - Order a list with unique rows with a given row as first item, then reorder the list but without the first row -
let's have list records in ("germany", "belgium", "netherlands", "spain", "russia", "italy").
and want order list "belgium" on top of list.
so when load list combobox "belgium" selectedvalue load.
now how order rest of list?
this have: "belgium" comes @ top rest not ordered.
homecoming enumerable.select(gettable() .orderbydescending(o => o.name == country) .thenby(o => o.name != country), b => new comboboxbase.comboboxliststructguid { id = b.countryid, description = b.country }).tolist();
return enumerable.select(gettable() .orderbydescending(o => o.name == country) .thenby(o => o.name), b => new comboboxbase.comboboxliststructguid { id = b.countryid, description = b.country }).tolist();
c# linq
Comments
Post a Comment