title: How to get filtered list based on common items in two lists in c#
body: <p>I am trying to get a list filtered based on the matches of one of the properties with a property of another list. 
  In below example, only the items which have common 'name' between both lists should be filtered in 1st list. Can some one tell me the most concise way of doing it?</p>
  
  <pre><code>class TCapability
  {
      public string Name { get; set; }
      public int Id { get; set; }
  }
  
  class PCapability
  {
      public string Name { get; set; }
      public int Code { get; set; }
  }
  </code></pre>
  
  <p>Input:</p>
  
  <pre><code>var capability = new List&lt;TCapability&gt;()
  {
      new TCapability() {Name="a", Id=1},
      new TCapability() {Name="b", Id=2},
      new TCapability() {Name="c", Id=3}
  };
  
  var type2Capability = new List&lt;PCapability&gt;()
  {
      new PCapability() {Name="a", Code=100},
      new PCapability() {Name="b", Code=200},
      new PCapability() {Name="d", Code=300}
  };
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>capability =
  {
      { Name="a", Id=1 },
      { Name="b", Id=2 }
  }
  </code></pre>