title: How to add items from datatable to list in asp.net
body: <p>I am creating a <code>web service method</code>, where i have to add items in list from <code>data-table</code>. How to do this? Here i am pasting my code. I am getting error in <code>items.Add(row)</code>.</p>
  
  <pre><code>[System.Web.Services.WebMethod]
  public static List&lt;SelectUsers&gt; GetUsers()
  {
      List&lt;SelectUsers&gt; items = new List&lt;SelectUsers&gt;();
  
      DataTable DetailsTbl = new DataTable();
      int gimId = 0;
      if (DetailsTbl.Rows[0]["RwId"] != "")
      {
          gimId = Convert.ToInt32(DetailsTbl.Rows[0]["RwId"]);
  
      }  
      DataTable dtAssignTo = SLAFacadeBLL.GetGIMIncidentUsers(gimId);
      if (dtAssignTo != null &amp;&amp; dtAssignTo.Rows.Count &gt; 0)
      {
          foreach (DataRow row in dtAssignTo.Rows)
          {
              items.Add(row);
          }
          return items;
      }                
  }
  </code></pre>
  
  <p>SelectUsers.cs:</p>
  
  <pre><code>public class SelectUsers
  {
      public string Value { get; set; }
      public string Text { get; set; }
  }
  </code></pre>
  
  <p>Can anyone give any suggestion?</p>