Possible Duplicate:
How can I easily convert DataReader to List<T>?
I want to put the data which is coming from datareader object in a generic list. I have done like this but it doesn't work...
I am getting cast exception error in foreach row!
SqlDataReader pointreader = cmd2.ExecuteReader();
var pointt = new List<int>();
while (pointreader.Read())
{
foreach (int item in pointreader)
{
pointt.Add(item);
if (pointt.Contains(point))
{
matchpoint = item;
}
}
}