1.The IList interface is defined in the System.Collections namespace and its equivalent of the same name is defined in the System.Collections.Generic namespace.
2.Example : //Namespace
using System.Collections.Generic;
private void BindData() { IList userinfos = new List(); for (int i = 0; i < 5; i++) { UserInfo info = new UserInfo("username" + i.ToString(), "password" + i.ToString()); userinfos.Add(info); } this.GridView1.DataSource = userinfos; //Bind data to GridView Control this.GridView1.DataBind(); }
//Class UserInfo
public class UserInfo { private string _userName = string.Empty; private string _password = string.Empty;
Arjun PanwarPosted Nov 17, 2011, 3:33 AM
Satyapriya NayakPosted Nov 17, 2011, 12:34 AM
Please refer the below link
http://www.aspnettutorials.com/tutorials/advanced/ilist-aspnet2-csharp.aspx
Thanks
Priya LingePosted Nov 17, 2011, 12:24 AM
1.The IList interface is defined in the System.Collections namespace and its equivalent
of the same name is defined in the System.Collections.Generic namespace.
2.Example :
//Namespace
using System.Collections.Generic;
private void BindData() userinfos = new List();
{
IList
for (int i = 0; i < 5; i++)
{
UserInfo info = new UserInfo("username" + i.ToString(), "password" + i.ToString());
userinfos.Add(info);
}
this.GridView1.DataSource = userinfos; //Bind data to GridView Control
this.GridView1.DataBind();
}
//Class UserInfo
public class UserInfo
{
private string _userName = string.Empty;
private string _password = string.Empty;
public UserInfo()
{
}
public UserInfo(string userName, string password)
{
this._userName = userName;
this._password = password;
}
public string UserName
{
get
{
return _userName;
}
}
public string Password
{
get
{
return _password;
}
}
}
3.Example of IList :Below link explain how to use IList .
http://www.csharpkey.com/aspnet/collections/introduction3.htm
Hope this will help you.
Thanks.