Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compare two IQueryable instances

Tags:

c#

linq

I have two IQueryable instances - objIQuerableA and objIQueryableB and I want to obtain only elements that are present in objIQuerableA and not in objIQuerableB.

One way is to use a foreach loop but I wonder if there is a better method.


1 Answers

Simple and straight forward.

var result = objIQuerableA.Except(objIQuerableB);
like image 136
Daniel Brückner Avatar answered Oct 20 '25 04:10

Daniel Brückner