假设我有LINQ查询,例如:
var authors = from x in authorsList
where x.firstname == "Bob"
select x;
Run Code Online (Sandbox Code Playgroud)
鉴于它authorsList是类型List<Author>,我如何删除查询返回的Author元素?authorsListauthors
或者换句话说,如何删除所有名字等于Bob的名字authorsList?
注意:这是用于问题目的的简化示例.
我有一个名为Customer的实体,它有三个属性:
public class Customer {
public virtual Guid CompanyId;
public virtual long Id;
public virtual string Name;
}
Run Code Online (Sandbox Code Playgroud)
我还有一个名为Splitting的实体,它有三个属性:
public class Splitting {
public virtual long CustomerId;
public virtual long Id;
public virtual string Name;
}
Run Code Online (Sandbox Code Playgroud)
现在我需要编写一个获取companyId和customerId的方法.该方法应返回与companyId中特定customerId相关的拆分列表.像这样的东西:
public IList<Splitting> get(Guid companyId, long customrId) {
var res=from s in Splitting
from c in Customer
...... how to continue?
return res.ToList();
}
Run Code Online (Sandbox Code Playgroud)