title: ASP.NET MVC View can't see member of an anonymous object viewModel
body: <p>I am trying to create an anonymous object view model with one member being from the Models folder, and another being from my own custom classes folder:</p>
  <pre><code>var viewModel = new {
      test1 = new Models.Test1(),
      test2 = new Classes.Test2()
  };
  
  return View(viewModel);
  </code></pre>
  <p>In the view, <code>@Model</code>, if you pause/breakpoint, and inspect it with the Visual Studio debugger, contains:</p>
  <p>Model [press enter]:</p>
  <pre><code>{ Test1 = {MVC_Test1.Models.Test1}, Test2 = {MVC_Test1.Classes.Test2} }
      Test1: {MVC_Test1.Models.Test1}
      Test2: {MVC_Test1.Classes.Test2}
  </code></pre>
  <p>However, if you try the following:</p>
  <p>Model.Test1 [press enter]</p>
  <blockquote>
  <p>'Model.Test1' threw an exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException'<br />
  Message: &quot;'object' does not contain a definition for 'Test1'&quot;</p>
  </blockquote>
  <p>What is wrong? Is there a way to refer to a dynamically created view model done this way? Or must I explicitly create a class that instantiates <code>Models.Test1()</code> and <code>Classes.Test2()</code> into one class, and use that instead of the anonymous object?</p>