111,117
社区成员
发帖
与我相关
我的任务
分享
class A
{
public int ID;
public string Name;
}
class B
{
public int Id;
public string Name;
public string other;
public DateTime addtime;
}
List<A> lista = new List<A>();
lista.Add(new A() { ID = 1, Name = "test1" });
lista.Add(new A() { ID = 2, Name = "test2" });
lista.Add(new A() { ID = 3, Name = "test3" });
lista.Add(new A() { ID = 4, Name = "test4" });
List<B> listb = new List<B>();
listb.Add(new B() { Id = 3 ,Name = "test3", other="ttt" });
listb.Add(new B() { Id = 4, Name = "test4", other = "ccc" });
listb.Add(new B() { Id = 5, Name = "test5", other = "ddd" });
listb.Add(new B() { Id = 6, Name = "test6", other = "eee" });
//
var bb = from b in listb
where b.Id ???? <-- 这里该怎么过滤
select b;
//目的是要找出这2行记录
listb.Add(new B() { Id = 3 ,Name = "test3", other="ttt" });
listb.Add(new B() { Id = 4, Name = "test4", other = "ccc" });