2011-11-13 62 views
1

我已经从我的ASP.net页GridView的员工的数组列表如下图所示:ArrayList和列表的问题

ArrayList tempempList = new ArrayList(); 
     List<Employee> emps = new List<Employee>(); 
     for (int i = 0; i < gvemp.Rows.Count; i++) 
     { 
      if (((CheckBox)gvemp.Rows[i].FindControl("cbAssign")).Checked) 
      { 
       tempempList.Add(((Label)gvemp.Rows[i].FindControl("lblempSeqNo")).Text); 
      } 
     } 

现在我有列表和Employee对象包括以下特性 的EMPID, empName,empAge,empSalary

现在从tempempList每个EMPID我需要填充列表

我不知道我怎么能填充环境管理计划。

感谢您的帮助

回答

1

List<T>对象仅仅是强类型的ArrayList版(通用)。 ArrayList用于传统用途,必要时应使用List<T>

您可以拨打List<T>.Add()方法,就像您为ArrayList.Add()方法所做的一样。因此,像:

emps.Add(yourValue);

这应该足够了。

+0

谢谢。但是,我在哪里填充每个员工对象? – acadia