title: Late binding issue with MVC3 ViewBag in VB.NET
body: <p>I'm trying out MVC Scaffolding in a VB.NET MVC3 project and running into an issue with late binding with Option Strict set on (and I want it on).</p>
  
  <p>This works in C#:</p>
  
  <pre><code>public ActionResult Create()
  {
      ViewBag.PossibleTeams = context.Teams;
      return View();
  }
  </code></pre>
  
  <p>but the virtually the same code in VB.NET:</p>
  
  <pre><code>Public Function Create() As ActionResult
      ViewBag.PossibleTeams = context.Teams
      Return View()
  End Function
  </code></pre>
  
  <p>causes the compiler error <em>Option Strict On disallows late binding</em>.  I took a look at the documentation here: <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.controllerbase.viewbag(VS.98).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.web.mvc.controllerbase.viewbag(VS.98).aspx</a> but it wasn't very helpful.</p>
  
  <p>I notice that a new empty application in C# uses the <code>ViewBag</code> in the <code>HomeController</code> but the VB.NET version uses <code>ViewData</code>, so maybe this is a VB.NET limitation.</p>