Most Efficient Way to Create Simple List<string>

Posts   
 
    
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 12-May-2008 16:36:07   

I have a requirement where I need to pull a large collection of strings into memory from the database, which essentially will end up being a List<string>.

I know how to do this using a dynamic list. I can simply create a single ResultsetField, run the query, and then loop over the datatable and create the list.

My question: would using a projection be a more efficient way of achieving this?

Is it possible to project onto a List<string> (I've haven't used projections to date).

Thanks for any insight.

Phil

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 13-May-2008 04:50:00   

You should grab the DataProjectorToValueList in the v2.6 beta (runtime sourcecode) and use that class in v2.5 with a projection.

You can see how the projection system work at LLBLGenPro Help files.

David Elizondo | LLBLGen Support Team