var filter= from c in listB.AsEnumerable()
where Convert.ToString(c["Title"]( != (from d in listA.AsEnumerable()
select d["Tilte"]).Cast<string>()
select c;
var names =
from d in listA.AsEnumerable()
select d["Tilte"].ToString()).ToList();
var filter= from c in listB.AsEnumerable()
where names.IndexOf(c["Title"].ToString())<0
select c;
thaqi498
Member
19 Points
62 Posts
LINQ not equal to operator
May 04, 2012 01:40 PM|LINK
hello all,
var filter= from c in listB.AsEnumerable() where c["Title"] != (from d in listA.AsEnumerable() select d["Tilte"]) select c;I am getting all the records
I am unable to filter it..any help?
robwscott
Star
8079 Points
1491 Posts
Re: LINQ not equal to operator
May 04, 2012 01:44 PM|LINK
try execpt
var filter = from c in listB.AsEnumberable() where c["Title"].Except((from d in listA.AsEnumberable() select d["Title"]) select c;Mark Answered if it helps - Good luck!
Cheers!
Design And Align
- Rob
AidyF
Star
9204 Points
1570 Posts
Re: LINQ not equal to operator
May 04, 2012 01:51 PM|LINK
Do you have a typing mistake? You use "Title" and "Tilte". Anyway;
var filter = from c in listB where !listA.Any(d => d["Title"] == c["Title"]) select c;Mastan Oli
Contributor
5088 Points
998 Posts
Re: LINQ not equal to operator
May 04, 2012 02:41 PM|LINK
Casting problem, so it doesnt check... change to
var filter= from c in listB.AsEnumerable() where Convert.ToString(c["Title"]( != (from d in listA.AsEnumerable() select d["Tilte"]).Cast<string>() select c;playingOOPS | மெய்ப்பொருள் காண்பதறிவு
Mark as Answer If you find helpful
thaqi498
Member
19 Points
62 Posts
Re: LINQ not equal to operator
May 05, 2012 07:21 AM|LINK
Thanks all of you.I found the solution
var filter= from c in listB.AsEnumerable() where !(from o in listA.AsEnumerable() select o["Title"]).Contains(c["Title"].ToString()) select c;Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: LINQ not equal to operator
May 06, 2012 01:38 AM|LINK
Hello thaqi498:)
I think it's time for you to use this:
var names = from d in listA.AsEnumerable() select d["Tilte"].ToString()).ToList(); var filter= from c in listB.AsEnumerable() where names.IndexOf(c["Title"].ToString())<0 select c;