title: Error using ExpandoObject in ASP.NET MVC
body: <p>I have an ASP.NET MVC app. I am using the <code>ExpandoObject</code> in my app. Currently, I have the following block in my .cshtml file:</p>
  
  <pre><code>foreach (System.Dynamic.ExpandoObject expo in ViewBag.ExpandoObjects)
  {
    &lt;div&gt;@filter.GetType().FullName&lt;/div&gt;
  }  
  </code></pre>
  
  <p>This code works fine. In fact, it prints out <code>System.Dynamic.ExpandoObject</code> onto the screen like I'd expect. However, when I update the code to the following, I get an error.                      </p>
  
  <pre><code>foreach (System.Dynamic.ExpandoObject expo in ViewBag.ExpandoObjects)
  {
    foreach (var key in expo.Keys) 
    {
      &lt;div&gt;@key&lt;/div&gt;
    }
  }                  
  </code></pre>
  
  <p>The error says:</p>
  
  <pre><code>CS1061: 'System.Dynamic.ExpandoObject' does not contain a definition for 'Keys' and no extension method 'Keys' accepting a first argument of type 'System.Dynamic.ExpandoObject' could be found (are you missing a using directive or an assembly reference?)      
  </code></pre>
  
  <p>I do not understand why I'm getting this error. According to the documentation, there is a <a href="http://msdn.microsoft.com/en-us/library/dd630187(v=vs.110).aspx" rel="nofollow">Keys property</a>. What am I missing?</p>