c# - How to move a range of items in a list to the end of the list -
i want display user client note @ bottom of screen. i'm doing separate user client note rest of notes add them again list. since addrange add range @ end, obtain expected.
var note1 = _notes.where(n => n.notetypeid != (int)notetypes.user_client_note); var note2 = _notes.where(n => n.notetypeid == (int)notetypes.user_client_note); _notes = new list<projectsactivenote>(); _notes.addrange(note1); _notes.addrange(note2); i wonder whether there method directly.
you use orderby.
_notes = _notes.orderby(n => n.notetypeid != (int)notetypes.user_client_note ? 0 : 1).tolist(); essentially, put notes aren't user client notes first because order return 0 , return 1 others. in test, still preserves order within separate groups.
Comments
Post a Comment