Project Description
Linq2File is a helper for developer who need to parse files or streams in any format: csv file, flat file.
No worry about how to parse a file. Just a class decorated with the right attributes used by Linq2File to generate a strongly typed enumerator.
Project documentation and tutorials
http://linq2file.codeplex.com/documentation
Input file Examples



Code to parse a file
Simple query:
using (FileQuery<FlatTable> fileQuery =
new FileQuery<FlatTable>(@"InputTestFiles\Book1.txt"))
fileQuery.Content.Where(i => i.Field2 != 12).ToList().ForEach(i =>
Console.WriteLine("{0} {1} {2}", i.DateField, i.Field1, i.Field2));
Advanced query:
using (FileQuery<Compte> fileQuery =
new FileQuery<Compte>(@"InputTestFiles\Comptes.csv"))
fileQuery.Content.GroupBy(i => i.Date.Year).Select(i =>
new { Year = i.Key, Total = i.Sum(g => g.Amount) }).ToList().ForEach(i =>
Console.WriteLine("Total for year {0}: {1}", i.Year, i.Total));