Link to home
Start Free TrialLog in
Avatar of lapucca
lapucca

asked on

What's the best way to load up data read in from sql server to a generic colleciton variable?

Should I use the SqlDataReader in a while loop to read each record into a generic colleciton var using the Add method?  assigning each column to a property in a object or is there a better way to do this?

After I load up the data into the generic collection variable, how do I find the object that let's say the Id property = 5?

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Dmitry G
Dmitry G
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lapucca
lapucca

ASKER

Generic collection , List<T>, doesn't it have a Find method with a key?