Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 54343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:12:19+00:00 2026-05-10T17:12:19+00:00

I have two collections which have property Email in both collections. I need to

  • 0

I have two collections which have property Email in both collections. I need to get a list of the items in the first list where Email does not exist in the second list. With SQL I would just use ‘not in’, but I do not know the equivalent in LINQ. How is that done?

So far I have a join, like…

var matches = from item1 in list1 join item2 in list2 on item1.Email equals item2.Email select new { Email = list1.Email }; 

But I cannot join since I need the difference and the join would fail. I need some way of using Contains or Exists I believe. I just have not found an example to do that yet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:12:19+00:00Added an answer on May 10, 2026 at 5:12 pm

    I don’t know if this will help you but..

    NorthwindDataContext dc = new NorthwindDataContext();     dc.Log = Console.Out;  var query =         from c in dc.Customers         where !(from o in dc.Orders                 select o.CustomerID)                .Contains(c.CustomerID)         select c;  foreach (var c in query) Console.WriteLine( c ); 

    from The NOT IN clause in LINQ to SQL by Marco Russo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two collections List<CustomClass1> items1 List<CustomClass2> items2 CustomClass1 has a property KEY CustomClass2
I have two collections as below which hold IDs for Students. The ids are
I have two generic collections in my code, EventableCollection and EventableSortedList - which are
I have a class which has two HashSet<String> collections as private members. Other classes
I have collections with huge amount of Documents on which I need to do
I have two collections List<Car> currentCars = GetCurrentCars(); List<Car> newCars = GetNewCars(); I don't
I have a mongo collection which has documents with two fields fieldA and fieldB,
i have what seems like a common problem / pattern. two collections of the
So, I have a list containing a custom class, MyClass MyClass has properties, which
I have written a program which will serialize and de-serialize, it does this fine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.