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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:45:39+00:00 2026-05-25T20:45:39+00:00

Looking up values in two different tables with LinqToSQL, and combining the results based

  • 0

Looking up values in two different tables with LinqToSQL, and combining the results based on what is found in what resultset.

How can I combine two Funcs based on given conditions:

 // a filter for a LinqToSQL query:
 Func<ComputerDetail, bool> filter;

 // declare the default filter
 filter = x => x.ComputerName.Contains(searchTerm);

then if a condition is met it would like to add the below lambda to the above one:

 x => computernames.Contains(x.ComputerName)

so it both would result in:

 x => computernames.Contains(x.ComputerName)) ||
      x.ComputerName.Contains(searchTerm);

Creating a multicast delegate with a plus operator almost seems to do it,
however, I am not sure how to apply the OR (||) in this case:

 filter += computernames.Contains(x.ComputerName) 

note: computernames is a List<String> , ComputerName is a property of ComputerDetail which is a Class representing a View in LinqToSQL

  • 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-05-25T20:45:40+00:00Added an answer on May 25, 2026 at 8:45 pm

    If it’s LINQ to SQL, you don’t want to combine two delegates – you want to combine two expression trees. Otherwise all of your filtering will be done on the client side.

    If that’s the case, I believe you basically just need PredicateBuilder – use predicate1.Or(predicate2) to combine two predicates.

    If you really want the delegate form, you can take the same code and just change all the signatures to use delegates instead of expression trees.

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

Sidebar

Related Questions

I am looking to insert records from xml into two different tables. For example
I am trying to compare two different arrays. I am looking for the values
Looking in the android sdk folders, I've found a file called values/config.xml . This
I have two tables which have the exact same structure. Both tables can store
I have a page that pulls together aggregate data from two different tables. I
Is there any way, how I can to identify two xpath values in one.
I'm looking to extract values from a whole load of html (i've just trimmed
Am looking for a query to sum values in a particular time duration say
I'm looking to grab cookie values for the same domain within a Flash movie.
I'm looking for all the current standard header values a web server would generally

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.