title: Cannot apply indexing with [] to an expression of type
body: <p>I have this simple MVC 4 code. I querying the database and getting all the results, saving then in a ViewBag object and then looping through them with a foreach but the an error:</p>
  
  <blockquote>
    <p>Cannot apply indexing with [] to an expression of type</p>
  </blockquote>
  
  <p>does not let me show them. What im missing? </p>
  
  <p>Here the sql query with entityframework</p>
  
  <pre><code>public ActionResult Index()
  {
      var ReturnLabelsAndInputsForIndexations = Conexion.MainConexion;
  
      var IndexationForm = ReturnLabelsAndInputsForIndexations.Labels.ToList();
      ViewBag.IndexationForm = IndexationForm;
  
      return View();
  }
  </code></pre>
  
  <p>And the index View</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta name="viewport" content="width=device-width" /&gt;
      &lt;title&gt;Index&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div&gt;
          &lt;table&gt;
          @foreach (var Indexacion_Labels in ViewBag.IndexationForm)
          { 
              &lt;tr&gt;
                  &lt;td&gt;@Indexacion_Labels["LABELS"]//Exception HERE&lt;/td&gt;
                  &lt;td&gt;@GetInputType(Indexacion_Labels["INPUT_TYPE"], Indexacion_Labels["NAME"])&lt;/td&gt;
              &lt;/tr&gt;
          }
          &lt;/table&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html
  </code></pre>