title: SelectList wont accept my SelectListItem object
body: <p>Im trying to populate my Html.Listbox with all the users of my ASP.NET user database.</p>
  
  <p>I have created a ViewModel that looks like this:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel.DataAnnotations;
  using System.Globalization;
  using System.Web.Mvc;
  using System.Web.Security;
  
  namespace SkyLearn.Areas.Users.Models
  {
  public class UsersViewModel
      {
          MembershipUserCollection membershipuserscollection { get; set; }
          public List&lt;MembershipUser&gt; membershipuserslist { get; set; }
          public List&lt;SelectListItem&gt; AvailableUsers { get; set; }
  
          public UsersViewModel()
          {
              availableUsers = new List&lt;SelectListItem&gt;();
          }  
      }
  }
  </code></pre>
  
  <p>And a Actionresult that looks like this:</p>
  
  <pre><code>        public ActionResult Index()
      {
          var users = Membership.GetAllUsers().Cast&lt;MembershipUser&gt;();
  
          UsersViewModel model = new UsersViewModel();
  
          foreach (MembershipUser user in users)
          {
              SelectListItem selectuser = new SelectListItem();
  
              selectuser.Text = user.UserName;
              selectuser.Value = user.UserName;
  
              model.AvailableUsers.Add(selectuser);
          }
  
          return View(model);
      }
  </code></pre>
  
  <p>On my view i try to populate the list like this:</p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&lt;SkyLearn.Areas.Users.Models.UsersViewModel&gt;" %&gt;
  
  
  &lt;%= Html.ListBox("AvailableUsers", Model.AvailableUsers)%&gt;
  </code></pre>
  
  <p>When i run the code i get the follow error:</p>
  
  <p>CS1579: foreach statement cannot operate on variables of type 'SkyLearn.Areas.Users.Models.UsersViewModel' because 'SkyLearn.Areas.Users.Models.UsersViewModel' does not contain a public definition for 'GetEnumerator'</p>