LINQ Group By into a Dictionary Object

前端 未结 4 392
野的像风
野的像风 2021-01-30 02:07

I am trying to use LINQ to create a Dictionary> from a List. I can get this to work using \"

4条回答
  •  醉梦人生
    2021-01-30 02:31

    The following worked for me.

    var temp = ctx.Set()
      .GroupBy(g => new { g.id })
      .ToDictionary(d => d.Key.id);
    

提交回复
热议问题