Your SlideShare is downloading. ×
20131108 linq tocsv by Jason
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

20131108 linq tocsv by Jason

71
views

Published on

linq tocsv by Jason

linq tocsv by Jason

Published in: Technology, Education

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
71
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. LINQ To CSV Jason
  • 2. CSV • A comma-separated values (CSV) (also sometimes called character-separated values, because the separator character does not have to be a comma) file stores tabular data (numbers and text) in plain-text form
  • 3. LINQ To CSV -Quick Start
  • 4. Reading from a file • Create a CsvFileDescription object • Create a CsvContext object
  • 5. Reading from a file • Read the file into an IEnumerable<T> using the CsvContext object's Read method
  • 6. Writing to a file • Create a CsvFileDescription object • Create a CsvContext object
  • 7. Writing to a file • Make sure the data is stored in an object that implements IEnumerable<T> • Invoke the Write method exposed by the CsvContext object to write the contents of your IEnumerable<T> to a file
  • 8. CsvContext.Read Overloads
  • 9. CsvColumn Attribute • • • • Name CanBeNull OutputFormat FieldIndex
  • 10. Name • Type • string • Default • Name of the field or property • Applies to • Reading and Writing
  • 11. CanBeNull • Type • bool • Default • true • Applies to • Reading only
  • 12. OutputFormat • Type • string • Default • "G" • Applies to • Writing only
  • 13. FieldIndex • Type • Int • Default • Int32.MaxValue • Applies to • Reading and Writing
  • 14. CsvFileDescription • • • • • • SeparatorChar QuoteAllFields FirstLineHasColumnNames TextEncoding DetectEncodingFromByteOrderMarks MaximumNbrExceptions
  • 15. SeparatorChar • Type • char • Default • ',' • Applies to • Reading and Writing
  • 16. QuoteAllFields • Type • bool • Default • false • Applies to • Writing only
  • 17. FirstLineHasColumnNames • Type • bool • Default • true • Applies to • Reading and Writing
  • 18. EnforceCsvColumnAttribute • Type • bool • Default • false • Applies to • Reading and Writing
  • 19. FileCultureName • Type • string • Default • current system setting • Applies to • Reading and Writing
  • 20. TextEncoding • Type • Encoding • Default • Encoding.UTF8 • Applies to • Reading and Writing
  • 21. DetectEncodingFromByteOrderMarks • Type • bool • Default • true • Applies to • Reading only
  • 22. Reference • LINQ to CSV Library • http://www.codeproject.com/Articles/25133/LINQ-to-CSV-library

×