1. Create a class called Customer:
public class Customer
{
public string name { get; set; }
}
2. At each loop of datareader, instantiate a Customer class and assign the data to the appropriate property, and add each instance into a list for later manipulation.
List<Customer> customers = new List<Customer>();
// you database operation here...
while(rdr.read())
{
Customer c = new Customer();
c.name = rdr["customername"].ToString();
customers.add(c);
}
// other code
The End.