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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:55:33+00:00 2026-05-11T14:55:33+00:00

Single and multiple lists Consider the following lists: List<Int32> appleIdentities = new List<int>(new[] {

  • 0

Single and multiple lists

Consider the following lists:

List<Int32> appleIdentities = new List<int>(new[] { 1, 2, 3 }); List<Int32> chocolateIdentities = new List<int>(new[] { 2, 3, 4 }); List<Int32> icecreamIdentities = new List<int>(new[] { 11, 14, 15, 16 }); 

Using LINQ to SQL; is it possible to wite a statement which translates into:

SELECT     DesertsID,     DesertsName FROM     Deserts WHERE     Deserts.AppleIdentity IN (1, 2, 3) AND     Deserts.ChocolateIdentity IN (2, 3, 4) AND     Deserts.IcecreamIdentity IN (11, 14, 15m 16) 

If yes; how would the code look if I wanted to query my database of deserts against just the appleIdentities list?

Arrays

Consider the following arrays:

Int32[] appleIdentities = new[] {1, 2, 3, 4}; String[] chocolateNames = new[] {'Light', 'Dark'}; 

Using LINQ to SQL; is it possible to wite a statement which translates into:

SELECT     DesertsID,     DesertsName FROM     Deserts WHERE     Deserts.AppleIdentity IN (1, 2, 3) AND     Deserts.ChocolateName IN ('Light', 'Dark') 

If yes; how would the code look if I wanted to query my database of deserts against just the appleIdentities array?

List of objects

Consider the following:

public class Identities {     public Int32 appleIdentity { get; set; }     public String chokolateName { get; set; } }  List<Identities> identities = new List<Identities>(new[] {     new Identities { appleIdentity = 1, chokolateName = 'Light' },     new Identities { appleIdentity = 2, chokolateName = 'Dark' }, }); 

Using LINQ to SQL; is it possible to wite a statement which translates into:

SELECT     DesertsID,     DesertsName FROM     Deserts WHERE     Deserts.AppleIdentity IN (1, 2) AND     Deserts.ChocolateName IN ('Light', 'Dark') 

If yes; how would the code look if I wanted to query my database of deserts against just the appleIdentity-property on my list of Identities objects?

This is branch off of LINQ to SQL query against a list of entities

  • 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-11T14:55:34+00:00Added an answer on May 11, 2026 at 2:55 pm

    Sure – just use Contains – using Northwind as an example:

    var qry = from cust in ctx.Customers           where custIds.Contains(cust.CustomerID)              && regions.Contains(cust.Region)           select cust; // or your custom projection 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to combine multiple lists of items into a single list, retaining the
I have text documents like the following which contain single and multiple variables: title::
I'm using acts_as_nested_set on a model which is called node. There are multiple lists
I need to read a single file using multiple threads under Linux. There are
So I have a List<SearchResult> Results that will return multiple results for a single
This tutorial - http://andytsui.wordpress.com/2011/06/29/tutorial-displaying-multiple-lists-in-one-single-listview-with-android-binding/ - shows exactly what I want to do, but it
My project has multiple lists, such as People, Jobs, Ranks. For each list, I
I have the following XML structure, which is modelling a single concept across multiple
How to update ms access table which contains single column with multiple rows. the
Multiple NSURLConnections being started (in a single UIViewController) to gather different kinds of data.

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.