title: Return List To View
body: <p>Every Time I loop through the viewbag it gives this error </p>
  
  <blockquote>
    <p>object' does not contain a definition for 'Name'</p>
  </blockquote>
  
  <p>This My Action</p>
  
  <pre><code>public ActionResult AssignTask() 
  {
      var List = db.Employees.Select(x =&gt; new 
      { 
          id = x.id, 
          Name = x.Name
      }).ToList();
  
      ViewBag.Emp_data = List;
  
      return View();
  }
  </code></pre>
  
  <p>and this is my view 
  <a href="https://i.stack.imgur.com/wmnHa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wmnHa.png" alt="enter image description here"></a></p>