protected void Button1_Click(object sender, EventArgs e)
{
// using System.Configuration;
// using System.Collections.Generic;
DataTable dt = new userBLL().SelectAll();
List<int> list = new List<int>(); //实例化
foreach(DataRow dr in dt.Rows) //遍历id字段
{
int id = Convert.ToInt32( dr["id"].ToString());
list.Add(id);
}
//for (int i = 0; i<list.Count; i++) //遍历泛型
//{
// int t=list[i];
// Response.Write(t);
//}
foreach (int t in list) //遍历泛型
{
Console.Write(t);
}
}
泛型