title: Unable to cast object of type WhereSelectListIterator 2 System.Collections.Generic.List
body: <p>I am working on these lists to get an item that matches the selected item from the combobox. </p>
  
  <pre><code>private void InitializaMessageElement()
  {
      if (_selectedTransactionWsName != null)
      {
  </code></pre>
  
  <ol>
  <li><p>get a transaction webservice name matching the selected item from the drop down here the output=TestWS  which is correct</p>
  
  <pre><code>var getTranTypeWsName = TransactionTypeVModel
       .GetAllTransactionTypes()
       .FirstOrDefault(transTypes =&gt; 
               transTypes.WsMethodName == _selectedTransactionWsName);
  </code></pre></li>
  <li><p>Loop the list of wsnames from the treenode list. Here it gives me all the node I have which is correct.</p>
  
  <pre><code>var wsNameList = MessageElementVModel
       .GetAllTreeNodes().Select(ame =&gt; 
               ame.Children).ToList();//. == getTranTypeWsName.WsMethodName);
  </code></pre></li>
  <li><p>find the getTranTypeWsName.WsMethodName in the  wsNameList. Here is where I have the problem:</p>
  
  <pre><code>      var msgElementList = wsNameList.Select(x =&gt; x.Where(ame =&gt; getTranTypeWsName != null &amp;&amp; ame.Name == getTranTypeWsName.WsMethodName)).ToList();
  </code></pre></li>
  </ol>
  
  <p>my MsgElement list:</p>
  
  <pre><code>    MsgElementObsList = new ObservableCollection&lt;MessageElementViewModel&gt;(msgElementList);
      this.messageElements = _msgElementList;
      NotifyPropertyChanged("MessageElements");
  }
  </code></pre>
  
  <p>Here it is throwing the cast  error. why is it not working? I am new to LINQ.  thanks</p>