Linq Query Help Needed

Posted by Randy Minder on Stack Overflow See other posts from Stack Overflow or by Randy Minder
Published on 2010-05-21T13:01:01Z Indexed on 2010/05/21 13:10 UTC
Read the original article Hit count: 448

Filed under:
|

Say I have the following LINQ queries:

var source = from workflow in sourceWorkflowList
             select new { SubID = workflow.SubID,
                          ReadTime = workflow.ReadTime,
                          ProcessID = workflow.ProcessID,
                          LineID = workflow.LineID };

var target = from workflow in targetWorkflowList
             select new { SubID = workflow.SubID,
                          ReadTime = workflow.ReadTime,
                          ProcessID = workflow.ProcessID,
                          LineID = workflow.LineID };

var difference = source.Except(target);

sourceWorkflowList and targetWorkflowList have the exact same column definitions. But they both contain more columns of data than what is shown in the queries above. Those are just the columns needed for this particular issue.

difference contains all rows in sourceWorkflowList that are not contained in targetWorkflowList

Now what I would like to do is to remove all rows from sourceWorkflowList that do not exist in difference. Could someone show me a query that would do this?

Thanks very much - Randy

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ