Group By Having Count > 1 in Linq -


this question has answer here:

i have following data

date          | projecttypeid --------------  ------------- 10/31/2016    |     1 11/30/2016    |     2 12/31/2016    |     2 01/01/2016    |     3 

what linq query dates projecttypeids has dates count > 1

results should yield me following list of dates because projecttypeid = 2 has 2 dates associated it

11/30/2016 12/31/2016 

something like:

var result = data.groupby(item => item.projecttypeid, item => item.date)                  .where(group => group.count() > 1)                  .selectmany(group => group)                  .tolist(); 

Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -