qq_37727187
qq_37727187
2019-03-30 13:32
采纳率: 57.7%
浏览 1.7k

Linq如何去除重复值问题

var data = (from u in _stone_storageService.LoadSearchData(roleQuery).AsEnumerable()
select new
{
u.ID ,
datetime = u.datetime.ToString(),
u.S_Number,
u.Settlement_Method,
u.supplier,
u.R_Amount,
u. Approval_Status ,
u.founder,
u.reviewer,
u.subject
});

        //构造成Json的格式传递
         var result = new { total = Math.Ceiling(Convert.ToDouble(roleQuery.Total * 1.0 / pageSize)), rows = data, records = roleQuery.Total };
        //var result = new { total = Math.Ceiling(Convert.ToDouble(data1.Count() * 1.0 / pageSize)), rows = data1, records = data1.Count() };
        return Json(result, JsonRequestBehavior.AllowGet);

                    以S_Number字段去除重复值,其余字段可以有重复值。
                    求大神指教!!!
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • caozhy
    已采纳

    var data = (from u in _stone_storageService.LoadSearchData(roleQuery).AsEnumerable()
    .GroupBy(x => x.S_Number).Select(x => x.First())

    点赞 评论

相关推荐