title: LINQ querying nested dictionary with multiple key value selection in C#
body: <p>I am facing an issue and cannot find any suitable solution for it. I have a nested dictionary that has a layout like this:</p>
  
  <pre><code>var dict = new Dictionary&lt;int, Dictionary&lt;string , dynamic&gt;&gt;()
  {
   0 : {Name : "abc" , marks1 : 05 , Marks2 : 10 , marks3 : 39},
   1 : {Name : "efg" , marks1 : 20 , Marks2 : 30 , marks3 : 25},
   2 : {Name : "hig" , marks1 : 30 , Marks2 : 40 , marks3 : 33},
   3 : {Name : "xyz" , marks1 : 40 , Marks2 : 10 , marks3 : 50}
  }
  </code></pre>
  
  <p>I am trying to query using LINQ to get the <code>id</code> of those queries, which are <code>true</code> but I am unable to select two or three criteria for a query. For one key-value the <strong>below query works fine</strong>:</p>
  
  <pre><code>    var query = from id in dict
                      from info in id.Value
                      where (info.Key == "marks1" &amp;&amp; Convert.ToDouble(info.Value) &gt; 10)
                      select id
  </code></pre>
  
  <p>But when I try 2 or 3 criteria to get the id of row for e.g below it <strong>does not work.</strong></p>
  
  <pre><code>    var query = from id in dict
                      from info in id.Value
                      where (info.Key == "marks1" &amp;&amp; Convert.ToDouble(info.Value) &gt; 10) 
                      &amp;&amp; (info.Key == "marks2" &amp;&amp; Convert.ToDouble(info.Value) &gt; 20)
                      select id 
  </code></pre>
  
  <p>Also if I have to compare the values with each other like values of <code>marks1</code> should be greater the <code>mark2</code> and <code>mark3</code>. How can I execute such query? Especially when I am not allowed to access value by key like this:</p>
  
  <pre><code>info["marks1"] &gt; ( info["mark2"] &amp;&amp; info["marks3"] )
  </code></pre>
  
  <p>in LINQ as it gives me the following error: </p>
  
  <blockquote>
    <p>cannot apply indexing with [] to an expression of type 'keyvaluepair &lt;
    string , dynamic></p>
  </blockquote>