title: Dictionaries and SelectMany()
body: <p>So I have these partial classes.  See below for the partial implementation of ParseFCIE and my question.</p>
  
  <pre><code>class CiscoSwitch
  {
      Dictionary&lt;int, CiscoVSAN&gt; VSANList = new Dictionary&lt;int, CiscoVSAN&gt;();
      public void ParseFCIE(string block) 
      {}
  }
  
  class CiscoVSAN
  {
       Dictionary&lt;string, CiscoSwitch&gt; MemberSwitches = new Dictionary&lt;string, CiscoSwitch&gt; ();
  } 
  </code></pre>
  
  <p>Part of ParseFCIE is to check whether an incoming switch in the input data is already in the SwitchMembers dictionary of any CiscoVSAN objects, if not, add it.  I have 2 dictionary statements.  The first statement works, the second the compiler says it can't determine the type of the predicate and I don't know why.  I prefer the second second statement since it is only one step.  The first way I have search for the switch then check for a null value on the result of the search.</p>
  
  <pre><code>ParseFCIE(string block)
  {  
       string DID = string.Empty;
       //partial implementation
       // 'this' is a CiscoSwitch object
       //this works
       var vsans= this.VSANList.SelectMany(v =&gt; v.Value.MemberSwitches.
                            Where(d =&gt; d.Value.switchName == this.switchName)); 
       // assume DID now has a value;
       // this line the compiler says the type arguments cannot be inferred from usage
       if (this.VSANList.SelectMany(v =&gt; v.Value.MemberSwitches.ContainsKey(DID))) 
       {}
  }
  </code></pre>