Using Linq is there a more efficient way to do this?
IDataReader reader = qSeats.ExecuteReader();
var seats = new List<int>();
using (IDataReader reader = qSeats.ExecuteReader())
{
while (reader.Read())
{
seats.Add(Convert.ToInt32(reader.GetInt32(0)));
}
}
I saw: How do I load data to a list from a dataReader?
However this is the same code I have above, and it seems like there could be faster ways.
Like using Linq or seats.AddRange() or some kind of ToList()
DataReader is read-only, forward-only stream of data from a database. The way you are doing it is probably the fastest.