Eden Ridgway's Blog

.Net and Web Development Information

  Home :: Contact :: Syndication  :: Login
  105 Posts :: 1 Stories :: 78 Comments :: 3 Trackbacks

Search

Article Categories

Archives

Post Categories

Development

General

If you are a .Net developer, there is very little reason why you should ever write your own CSV parser. SecretGeek has a pretty good blog post on why it is a bad idea. He mentions a library I have known about for a while called FileHelpers. It has some pretty awesome features, such as:
  • Serialization and deserialization of delimited or fixed width data
  • Attribute based field conversion definition (e.g. [FieldConverter(ConverterKind.Date, "dd-MM-yyyy")] ). You can also create custom converters.
  • File differences for files with the same record structure
  • The ability to skip empty or first/last N records
An alternative less powerful approach is to use Microsoft's XmlCsvReader. This is more useful if you want to treat the file like a read only XML document.
posted on Monday, February 19, 2007 7:52 AM
Comments have been closed on this topic.