title: Filtering List from a List
body: <p>Bottom line is I would like a linq statement that returns the same list as the code below.</p>
  
  <p>I feel like this is possible and I feel like I got very close before I gave up and just spelled out what I wanted with more lines of code.</p>
  
  <p>Although I would love and appreciate anyone that could demonstrate what I'm looking to achieve for the future and to replace what I have.</p>
  
  <pre><code>public ObservableCollection&lt;VarItem&gt; IndexChannels 
  {
      get
      {
          ObservableCollection&lt;VarItem&gt; filtered = new ObservableCollection&lt;VarItem&gt;();
  
          filtered.Add(indexChannels.First());//add Disabled no matter what
  
          //add the cur channels selected index if it isn't already disabled
          if (!filtered.Contains(indexChannels.FirstOrDefault(i =&gt; i == CurChannel.IndexChannel)))
          {
             filtered.Add(indexChannels.FirstOrDefault(i =&gt; i == CurChannel.IndexChannel));
          }
  
          foreach (PdioChannelModel ch in channels)
          {
             //if the channels mode isn't q-decode or quad index add its Number as an index
             if (ch.Mode.Value != "Q-Decode" &amp;&amp; ch.Mode.Value != "Quad Index") 
             {
                filtered.Add(indexChannels.FirstOrDefault(i =&gt; i.ID == ch.Number));
             }
          }
          return filtered;
      }
  }
  </code></pre>
  
  <p>Basic structure of VarItem</p>
  
  <p>public class VarItem
     {
        public int ID { get; private set; }
        public string Value { get; private set; }
        public Dictionary MetaData { get; private set; }</p>
  
  <pre><code>  public VarItem(int id, string value)
    {
       this.ID = id;
       this.Value = value;
       MetaData = new Dictionary&lt;string, string&gt;();
    }
  </code></pre>
  
  <p>example master list contains VarItems:</p>
  
  <p>-1, "Disable"</p>
  
  <p>1, "Channel 1"</p>
  
  <p>2, "Channel 2"</p>
  
  <p>3, "Channel 3"</p>
  
  <p>Filtered list should always contain <code>VarItem(-1, Disabled)</code>. It should also contain the <code>VarItem</code> where the <code>ID</code> matches <code>CurChannel.IndexChannel</code>and lastly it sould contain any <code>VarItem</code>s where the ID matches any <code>PdioChannelModel.Number</code> where <code>PdioChannelModel.Mode.Value != "Q-Decode" or "Quad Index"</code></p>
  
  <p>If I missed any detail needed let me know. If I confused you and wrote to much or need clarification just let me know as well.</p>