title: .Net 2 MVC 6 How to properly initialise and use List<Classname> in view?
body: <p><strong>Model class</strong></p>
  
  <pre><code>using System;
  
  namespace MySystem.Models
  {
      public class User
      {
          private string username;
          private string age;
  
          public User()
          {            
          }
  
          public User(string username, string age)
          {
              this.username = username;
              this.age = age;
          }
  
          public string Username 
          {   
              get { return username; } 
              set { username = value; }
          }
  
          public string Age
          {
              get { return age; }
              set { age = value; }
          }
      }
  }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>@using System.Linq
  @model List&lt;MySystem.Models.User&gt;
  @using (Html.BeginForm("AddWithHTMLHelperAndModel", 
  "List&lt;MySystem.Models.User&gt;", FormMethod.Post))
  {
     if (!Model.Any())
     {
        &lt;label&gt;Empty&lt;/label&gt; // Model is void, why??
        @Model.Add(new User("Username1", "35"))// Returns error that void can't be changed to obj.
     }
     else 
     {
         &lt;label&gt;Model has content.&lt;/label&gt;
     }
  }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>    public ActionResult AddWithHTMLHelperAndModel()
      {   
      List&lt;User&gt; usermodel = new List&lt;User&gt;();
  
                  return View(usermodel);
      }
  
      [HttpPost]
      public ActionResult AddWithHTMLHelperAndModel(List&lt;User&gt; user)
      {
          var updated_model = user;
  
          return View(updated_model);
     }
  </code></pre>
  
  <p>There appears to be an initialisation problem. No idea why. Before I was able to use the related model just with the reference to it in the beginning of the view (no separate initialisation required). </p>
  
  <p>Also, if I try my User model without the view, just in "main", it works as expected. What am I doing wrong?</p>