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

  • Home
  • SEARCH
  • 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 5943107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:20:53+00:00 2026-05-22T16:20:53+00:00

I have this foreach loop that is looping through a UserTaskQueueJoint Entity. This entity

  • 0

I have this foreach loop that is looping through a UserTaskQueueJoint Entity. This entity has three fields

  1. UserTaskQueueJoinID

  2. UserID

  3. TaskQueueID

it has a navigation property to taskQueues and to Tasks

I am running a foreach through these and only want to get the tasks out that are in the taskqueue. so as i go through this loop below i go through my foreach loop twice, the first time i get one task..then the second time through i get the additional two tasks, but it removes the first task. Im sure I am not supposed to be using a where clause, i think im should be using a select or a contains or an ‘in’ but Im stuck on how to implement.

foreach (var _taskQueueJoin in UserTaskQueueJoin)
{
_query = _query.Where(x => x.AssignedToTaskQueueID == _taskQueueJoin.TaskQueueID);   
}
  • 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-22T16:20:53+00:00Added an answer on May 22, 2026 at 4:20 pm

    Assuming I understood your question correctly, you can replace the whole loop with this:

    var TaskQueueIds = _taskQueueJoin.Select(t => t.TaskQueueID).ToArray()
    _query = _query.Where(x => TaskQueueIds.Contains(x.AssignedToTaskQueueID))
    

    It gets all the task queue ids together first. Then it filters _query with a single .Where().

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

Sidebar

Related Questions

I have a function that looks something like this: //iteration over scales foreach ($surveyScales
I have code that I want to look like this: List<Type> Os; ... foreach
I have a loop that iterates through elements in a list. I am required
I have this code here, {foreach from=$cart.cartItems item=item name=cart} <div id=cart2Produkt> <p>{if $item.Product.ID} <a
I have this code while($row = mysql_fetch_row($result)) { echo '<tr>'; $pk = $row[0]['ARTICLE_NO']; foreach($row
I have the following code: foreach (var control in this.Controls) { } I want
I have some code, int count = 0; list.ForEach(i => i.SomeFunction(count++)); This seems to
i have this crazy label for each time i create a migration that use
I have this code in jQuery, that I want to reimplement with the prototype
I have a multi-dimensional array right now that looks like this: function art_appreciation_feeds() {

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.