Listing B—Array binding
//NOTE: this snippet is assumed to be in a codebehind event handler
DataClass[] dc = new DataClass[5];
for(int i=0;i<5;i++){
       dc[i] = new DataClass();
       dc[i].ID=i;
       dc[i].Description="Item " + i;
}
this.ListBox1.DataSource = dc;
this.ListBox1.DataTextField = "Description";
this.ListBox1.DataValueField = "ID";
this.ListBox1.DataBind();

class DataClass{
       public string Description{
              get{return description;}
              set{description = value;}
       }
       public int ID{
              get{return id;}
              set{id = value;}
       }
       private string description;
       private int id;
}