LINQ to CSV using DynamicObject(thinqlinq.com)

submitted by KodefuGuruKodefuGuru(2818) 2 years, 5 months ago

When we wrote LINQ in Action we included a sample of how to simply query against a CSV file using the following LINQ query: 1.From line In File.ReadAllLines(“books.csv”) 2.Where Not Line.StartsWith(“#”) 3.Let parts = line.Split(“,”c) 4.Select Isbn = parts(0), Title = parts(1), Publisher = parts(3)While this code does make dealing with CSV easier, it would be nicer if we could refer to our columns as if they were properties where the property name came from the header row in the CSV file, perhaps using syntax like the following:

add a comment |category: |Views: 40

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

No comments so far

information Login or create an account to comment on this story