title: Set a property on ViewBag dynamic object in F#
body: <p>I have this action method in C#:</p>
  
  <p></p>
  
  <pre><code>  public ActionResult Index() {
        ViewBag.Message = "Hello";
        return View();
    }
  </code></pre>
  
  <p>And this view (Index.cshtml):</p>
  
  <pre><code>  &lt;h2&gt;@ViewBag.Message&lt;/h2&gt;
  </code></pre>
  
  <p>And this produces the expected "Hello" on the page.</p>
  
  <p>I want to do the controller in F#. I've tried</p>
  
  <pre><code>type MainController() =
    inherit Controller()
    member x.Index() =
      x.ViewBag?Message &lt;- "Hello"
      x.View()
  </code></pre>
  
  <p>And this produces the error message "Method or object constructor 'op_DynamicAssignment' not found". </p>
  
  <p>I've looked at some of the F# code samples for the dynamic operator, and I can't see anything that's shorter than several pages of description and many lines of code. They seem to be too general for just this property "setter".</p>