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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:15:43+00:00 2026-05-15T13:15:43+00:00

I have the following method signature: internal static int[] GetStudentIDsThatAreNotLinked(PrimaryKeyDataV1[] existingStudents, IQueryable<Student> linkedStudents) PrimaryKeyData

  • 0

I have the following method signature:

 internal static int[] GetStudentIDsThatAreNotLinked(PrimaryKeyDataV1[]
       existingStudents, IQueryable<Student> linkedStudents)

PrimaryKeyData is a class that has ServerID and LocalID integers as properties.
Student is a class that (among other properties) has an integer one called StudentID.

In English, what I want to do is return an array of integers which are in existingStudents[…].ServerID but not in linkedStudents[…].StudentID

If ‘existingStudents’ and ‘linkedStudents’ were both integer arrays, I would use a linq query as below:

return from es in existingStudents where
    !linkedStudents.Contains<int>(es) select es;

..which could then be converted to an array of ints.

What I want to do is give Contains an IEqualityOperator that will consider a PrimaryKeyData class to be equal to a Student class if PrimaryKeyData.ServerID == Student.StudentID

So I think I need a lambda expression but I’m very confused on how that would be constructed.

I think I’m going in the right direction but can anyone help me over the final hurdle?

  • 1 1 Answer
  • 1 View
  • 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-15T13:15:43+00:00Added an answer on May 15, 2026 at 1:15 pm

    So, my understanding is that you want to get all instances of PrimaryKeyDataV1 whose ServerID property doesn’t exist in any of the students.StudentID property of the linkedStudents parameter?

    internal static PrimaryKeyDataV1[] GetStudentsThatAreNotLinked(PrimaryKeyDataV1[] existingStudents, IQueryable<Student> linkedStudents)
    {
        var results = existingStudents.Select(s => s.ServerID)
            .Except(linkedStudents.Select(link => link.StudentID))
            .ToArray();
    
        return existingStudents.Where(stud => results.Contains(stud.ServerID));
    }
    

    Or if you just want an array of IDs…

    internal static int[] GetStudentIDsThatAreNotLinked(PrimaryKeyDataV1[] existingStudents, IQueryable<Student> linkedStudents)
    {
        return existingStudents.Select(s => s.ServerID)
            .Except(linkedStudents.Select(link => link.StudentID))
            .ToArray();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have the following method signature int f (int[] values) and I call
I have a general Java method with the following method signature: private static ResultSet
I have a controller method with the following signature: [AcceptVerbs(HttpVerbs.Post)] public ActionResult UpdateValues(int id,
I have the following method signature: public static void InvokeInFuture(Delegate method, params object[] args)
I have the following method signature: IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback
Let's say I have the following method: public static int CountNonNullMembers<T>(this IEnumerable<T> enumerable) {
I have a backingBean with following method (signature): public class SessionBean { ... public
I have the following method signature, how do i convert it to be a
I have a method with the following signature: public ActionResult RenderFamilyTree(string name, Dictionary<string, string>
I have an ASP.NET 2.0 web method with the following signature: [WebMethod] public QueryResult[]

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.