I have a lot of pre-linq C# 1.0 code which converts the output from a stored procedure (SQL 2005) into a collection of objects. It goes as follows:
- Declare a class with properties matching the columns in the output.
- using SqlDataReader, loop while there are rows to read
- For every row, add an object to a List
- return that list
Although most of that code was generated, I think linq should allow for a smarter way to do it. Do I have to explicitly declare a class? In C# 3.0, how should I converts the output from a stored procedure into a collection of objects?
Ideally I would like to generate code, because I don't like wizards. Thanks!
Edit: I dont have a dbml file. Do I have to have it if I use linq to sql? If yes, how to create it?