[求助]无法创建抽象类或接口“System.Collections.Generic.IList<Test>”的实例
protected void Page_Load(object sender, EventArgs e)
{
Repeater1.DataSource = getAllUsers();
Repeater1.DataBind();
--用实体类对象集合绑定Repeater--
}
private IList <Test> getAllUsers()
{
using (SqlDataReader sdr = SqlHelper.ExecuteReader(Config.conString,CommandType.Text, "select * from MyTest "))
{
IList <Test> test = new IList <Test> ();//问题处在这句,如题
while(sdr.Read())
{
Test t = new Test();
t.ID = Convert.ToInt32(sdr[ "id "].ToString());
t.Name = Convert.ToString(sdr[ "name "].ToString());
t.Address = Convert.ToString(sdr[ "address "].ToString());
t.Tel = Convert.ToString(sdr[ "tel "].ToString());
test.Add(t);
}
return test;
}
}
高手帮我看看是什么问题!
------解决方案--------------------IList <Test> test = new IList <Test> ();//
改成List <Test> test = new List <Test> ();
或者
IList <Test> test = new List <Test> ();