3 Replies
Is there a better way to add an item to a list than using the Add method? Not really, no.
BTW you should put your DataReader in a
using
to dispose it and you should use methods like GetInt32
and GetString
rather than casting.What if you use LINQ tho?
Is there no way to convert the while into a linq query?
The isn't really a straight forward way to use link to query results from a DataReader as this returns DataRows, not easily queryable objects with properties