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 8679435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:58:19+00:00 2026-06-12T20:58:19+00:00

May be my problem is common. I have seen it here Comparing Two collections

  • 0

May be my problem is common. I have seen it here Comparing Two collections. But I want to compare two complex collections.

public class Project
{
    public Int32 ProjectID { get; set; }
    public String ProjectName { get; set; }
    public String ProjectCode { get; set; }
}
public class Unit
{
    public Int32 UnitID { get; set; }
    public Int32 ProjectID { get; set; }
    public String UnitName { get; set; }
    public String UnitCode { get; set; }
}

Here Project and Unit have a Common field called ProjectID.And I have a Collection of Project and Unit. Corresponding to each project in the project collection, there is a unit in the unit collection. And some of the units in the unit collection is not belonging to any project in the project collection. I want to Filter out those units. How can I do that using Linq.

  • 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. Editorial Team
    Editorial Team
    2026-06-12T20:58:21+00:00Added an answer on June 12, 2026 at 8:58 pm

    You can use LINQ:

    var result = units.Where(u => projects.All(p => p.ProjectID != u.ProjectID));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may be a common problem but I'm struggling to find a solution that
I have to compare two complex objects which are of different types (and do
I have what I think is a fairly common problem, but I cannot seem
This problem may seem like school work, but it isn't. At best it is
This problem may be a little broad, but I'm going to go ahead and
I think I have a synchronization problem...It may be too basic..Please help.. I have
I may be approaching this problem from the wrong angle but what I'm thinking
this may seem like a simple problem but I couldn't find it in the
This may seem a common question but I googled to find the right answer
I have a very common problem which I think every android developer faces at

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.