Linq Intersect Client Side different Entities

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 14-Oct-2008 14:23:42   

I have client side 2 adapter-based Entities. CustomerX and CustomerY.

They are not related and come from different sources.

They both have a customerID field. I'd like to know all the CustomerXs that intersect with CustomerY on the cutomerID field.

Is there a client side way using Linq.Intersect perhaps?

Ian

Seth avatar
Seth
User
Posts: 204
Joined: 25-Mar-2006
# Posted on: 14-Oct-2008 17:17:32   

Once they are in memory you are certainly allowed to use any and alll extension methods on IEnumerable. I would just try to join them in memory using linq.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 15-Oct-2008 04:45:51   

Indeed InMemory linq query could be used in this case. You can do that using a join or simply an intersect:

var results = from c in customersX.Intersect(customersY)                        
              select c;
David Elizondo | LLBLGen Support Team