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?