Q:

Filter a long list of objects by one reference object

Given a) a long list of completed surveys, where a completed survey is nothing else but a list of (~100) answers in the form of

QuestionId, 
List GivenAnswers

and b) one filter survey, where some answers have been pre-selected (e.g. "female", "smoker"), how can I obtain the subset of completed surveys that fullfill the criterias defined in the filter survey?
EDIT:
These are the relevant classes:
public class Answer
{
    public int Id { get; set; }
    public Question Question { get; set; }
    public List<AnswerPossibility> SelectedAnswers { get; set; }
}

public class Survey
{
    public int Id { get; set; }
    public string Title { get; set; }
    public List<Question> Questions { get; set; }
}

public class CompletedSurvey
{
    public int Id { get; set; }
    public Survey Survey { get; set; }
    public List<Answer> Answers { get; set; }
}

public class Subset
{
    // used to define a filter criteria
    public int Id { get; set; }
    public Survey Survey { get; set; }
    public List<Answer> Answers { get; set; }
    public string Title { get; set; }
}

public class Question
{
    public int Id { get; set; }
    public string Text { get; set; }
    public QuestionType QuestionType { get; set; }
    public List<AnswerPossibility> AnswerPossibilities { get; set; }
}

So far, I have not yet come up with something compileable :o(
Oh man, John Skeet downvoted my question. That's it, I'm done with programming.. (just kidding ^^, I just started ..)

A:

Assuming the presence of,

CompletedSurvey key, which describes the "filter survey" that you've mentioned
IEnumerable<CompletedSurvey> answers, which describes people's actual answers

Then you can do something like this,
return answers.Select(survey => survey.Answers.Join(key.Answers,
                                                    a => a.Question.Id,
                                                    b => b.Question.Id,
                                                    (a, b) => new {
                                                                      answer = a,
                                                                      expected = b
                                                                  }))
              .Where(c => c.All(x => x.expected.SelectedAnswers
                                               .GroupJoin(x.answer.SelectedAnswers,
                                                          a => a.Id,
                                                          b => b.Id,
                                                          (a, b) => b.Any())));

This is totally untested, and I wrote it here in the answer box, so it might not be right. You might also be able to clean this up. But it should get you started.
The idea is to take the completed surveys that have answers to the ones listed in the key (via the join), then take only the those surveys which have all of the selected answers that are present in the key (via the group join). This is a super complicated way of doing it, and I suspect there's a better one, but this is what I came up with from what you've given us.

