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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:50:58+00:00 2026-05-23T03:50:58+00:00

Quick question: I’m comparing the IDs of entities in an EF4 EntityCollection against a

  • 0

Quick question: I’m comparing the IDs of entities in an EF4 EntityCollection against a simple int[] in a loop. I’d like to do something like:

for (int i = 0; i < Collection.Count; ++i)
{
    Array.Any(a => a.value == Collection[i].ID) ? /* display yes */ : /* display no */;
}

I’m just not sure how to compare the value within the array with the value from the EntityCollection, or, in other words, what to use for real instead of the value property I made up above.

  • 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-23T03:50:59+00:00Added an answer on May 23, 2026 at 3:50 am

    The code should be modified to read:

    int[] arr = //this is the integer array
    IEnumerable Collection = //This is your EF4 collection
    for (int i = 0; i < Collection.Count; ++i)
    {
        arr.Any(a => a == Collection[i].ID) ? /* display yes */ : /* display no */;
    }
    

    I called out a few variables at the top just so we’re clear as to what is what. The major part that changed was that instead of invoking Array.Any we’re invoking arr.Any. Any is an Extension method for int[] and thus you invoke it on the array itself, not on the class Array.

    Does this solve the problem?

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

Sidebar

Related Questions

Quick question here about short-circuiting statements in C#. With an if statement like this:
quick question. Is there any way to make this possible? int array [] =
quick question. I'd like to remove the sup tag from the following string, and
quick question: why wont this while-loop wait for input? (ing is a string) while(ing
quick question, I've been looking for a simple logging tool for AS3 projects (I
Quick question. Tried googling and SO and couldnt find anything like this. Is it
Quick question just to verify something. If I have an HTML5 mobile advertisement that
Quick question regarding settimeout, does it execute periodically like setinterval? Say I have a
Quick question, I have the following string which is a coma separated list of
Quick question. If i am trying to clear multiple divs with the same class

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.