title: Linq Method for Intersecting with a Condition
body: <p>I have the following POCO:</p>
  
  <pre><code>public class User {
      public ICollection&lt;DepartmentPosition&gt; DepartmentPositions { get; set; }
      public PerformanceRecord PerformanceRecord { get; set; }
  }
  </code></pre>
  
  <p>where <code>DepartmentPosition</code> is defined as:</p>
  
  <pre><code>public class DepartmentPosition {
     public Department Department { get; set; }
     public PositionType PositionType { get; set; }
  }
  </code></pre>
  
  <p>and <code>PositionType</code> is a enum defined as:</p>
  
  <pre><code> public enum PositionType : byte {
       Employee = 0,
       Manager = 1
   }
  </code></pre>
  
  <p>I want to be able to query whether a <code>Manager</code> is able to see an <code>Employee</code> <code>PeformanceRecord</code>.  </p>
  
  <p>The criteria for this is: </p>
  
  <p>If a Manager has a <code>DepartmentPosition</code> with a <code>PositionType</code> of <code>Manager</code>, and that particular <code>DepartmentPosition</code> also has a <code>Department</code> equal to the <code>Department</code> of any of the Employee's <code>DepartmentPositions</code>, then the Manager will be able to see the Performance Record for the Employee.</p>
  
  <p>There is a specification class being used for this:</p>
  
  <pre><code>public CanUserSeePerformanceRecord() {
      public bool IsSatisfiedBy(User fooUser, User barUser) {
           // PSUEDO CODE
  
           // Returns true if:
  
           // fooUser and barUser both have a DepartmentPosition with the same Department AND for barUser, the PositionType of the DepartmentPosition is Manager
      }
  }
  </code></pre>
  
  <p>I think you could do it using a Linq Intersect or similar, but not sure how to include the condition that the <code>barUser</code> has to hold a <code>DepartmentPosition</code> that is marked as <code>Manager</code>. </p>