Skip to content

Instantly share code, notes, and snippets.

@craftfortress
Created September 20, 2014 12:13
Show Gist options
  • Save craftfortress/880529496dfadbfd40ae to your computer and use it in GitHub Desktop.
Save craftfortress/880529496dfadbfd40ae to your computer and use it in GitHub Desktop.
statusList = new SelectList(ListNotifications.GroupBy(p => p.Status, (key, g) => key));
@craftfortress
Copy link
Author

statusList = new SelectList((ListNotifications.GroupBy(x => new { x.Status }).Select(x => x)),"Status","Status");
statusList = new SelectList(ListNotifications.GroupBy(p => p.Status, (key, g) => new { key}));
statusList = new SelectList(ListNotifications.Select(p => new { p.Status }).Distinct(), "Status", "Status");

@craftfortress
Copy link
Author

Alternative ways to get GroupBy results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment