Operator '&&' cannot be applied to operands of type List<> and List<>

asp.net-mvc entity-framework-6 linq

Question

 li = warehousetocustomlist.Where(x => x.Created_By == (long)HttpContext.Current.Session["Slno"]).ToList() && warehousetocustomlist.Where(x=>x.Type==3).ToList();

Here I'm checking two conditions which is present in the same list but it showing error as:

Operator '&&' cannot be applied to operands of type List<> and List<>.

1
0
3/8/2019 9:29:18 AM

Popular Answer

You have ToList in wrong place:

li = warehousetocustomlist
    .Where(x => x.Created_By == (long)HttpContext.Current.Session["Slno"] &&
           x.Type==3)
    .ToList();
1
9/17/2018 6:52:41 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow