一个List集合 SiemensShipmentWips里面有多个字段mawb,shipC、consC,RMB 四个字段。
需要根据字段mawb,shipC、consC 存在重复,并且RMB 小于5000金额的数据筛选出来。
请问使用LINQ语句如何编写查询条件?
相关问题
- Timer vs. repetitive background worker
- setInterval doesn't slow down on inactive tab
- Timers not running when screen is turned off / dev
- How to set timer in an event handler?
- extra argument userinfo in call
相关文章
- postgresql 月份差计算问题
- Is the HPET directly accessible in Windows?
- Blinking Button for Simon Says
- Timer Label not updated after switching views (swi
- Indy TIdTCPClient receive text
- A HR timers precision study case
- Chrono Timer Not Converting Seconds Properly
- How to move several buttons throughout the screen
感觉你这个意思是list去重吧?
class Program
{
static void Main(string[] args)
{
List<Student> list = new List<Student>();
list.Add(new Student {
a="1",
b="2",
c="3",
rmb=10000
});
list.Add(new Student
{
a = "1",
b = "2",
c = "3",
rmb = 3000
});
list.Add(new Student
{
a = "1",
b = "2",
c = "3",
rmb = 5000
});
list.Add(new Student
{
a = "1",
b = "3",
c = "3",
rmb = 10000
});
var result = list.Where(t1 => list.Any(t2 => t1.a == t2.a && t1.b == t2.b && t1.c == t2.c && t1.rmb <= 5000)).ToList();
Console.Read();
}
}
public class Student
{
public string a { get; set; }
public string b { get; set; }
public string c { get; set; }
public int rmb { get; set; }
}
试试。。。。。。。。。。
需要根据字段mawb,shipC、consC 存在重复 -----举个栗子
//先筛选出RMB<500的集合项,再进行字段重复筛选.
SiemensShipmentWips = SiemensShipmentWips.Where(x => x.RMB < 500);
var result = SiemensShipmentWips.Where(x=>
SiemensShipmentWips.Count(c=>c.mawb == x.mawb)>1 ||
SiemensShipmentWips.Count(c=>c.shipC == x.shipC)>1 ||
SiemensShipmentWips.Count(c=>c.consC == x.consC )>1 ||
);
ssws.where(a=>(a.mawb==a.shipC||a.mawb==a.consC ||a.shipC==a.consC ||)&&a.rmb<5000)