ITPub博客

首页 > 应用开发 > > c# 这个lambda表达式应该怎么写

c# 这个lambda表达式应该怎么写

作者:lilyone 时间:2019-08-12 15:42:51 0 删除 编辑

我要找到爸爸和他的所有性别为男的孩子

public List<爸爸> test123(int id)

{

var a = _爸爸Repository.GetAll()

.Where(t=>t.Id==id&& t.孩子.Any(c=>c.性别== 性别.男))

.Include(t => t.孩子).ToList();

return a;

}

我这样写赛选没起到作用,结果里依然有男有女.

c#lambda.net core

问题补充:

public class 爸爸: Entity

{

public string name { get; set; }

public List 孩子{ get; set; }

}

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4635/viewspace-3122538/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 数学问题 编程题
请登录后发表评论 登录
全部评论

注册时间:2019-08-01

  • 博文量
    159
  • 访问量
    977