开发者

How do i convert following query with lambda operator

var a = from u in Users
                group u by new {u.UserName,u.Address,u.City,u.State} into abc
                select ne开发者_Go百科w
                {
                    Count=abc.Count(),
                    Name= abc.Key.UserName,
                    Address=abc.Key.Address,
                    State=abc.Key.State,
                    City=abc.Key.City   
                };


Try this

var a = users.GroupBy(u => new {u.Username, u.Address, u.City, u.State})
        .Select(abc => new
                          {
                               Count = abc.Count(),
                               Name = abc.Key.Username,
                               Address = abc.Key.Address,
                               State = abc.Key.State,
                               City = abc.Key.City
                           });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜