tags:

views:

15

answers:

1

If I have a text file, which say is comma delimited and has several values per line, how could I use LINQ to insert this into a collection in an efficient manner (ie avoid loading the whole file (assume the file is large) at once when there may be a better way). I am using .NET 4.0 (VS2010 Beta 2). I know using the string's split method is involved

EDIT: I have found a couple of ways at http://blogs.msdn.com/ericwhite/archive/2006/08/31/linq-to-text-files.aspx but there may still be a better way...

Thanks

A: 

I was about to post something along the lines of Eric's Lines() method, which is the most efficient way to translate a file into a collection you can iterate, when I noticed your edit.

I'd say that's probably your best bet.

Randolpho