In this previous article articles about parsing files, I took a very simplistic approach to reading a delimited file. I used string.Split, which doesn’t handle the use of quotes and usage of the delimiter character inside quotes.
Well, it turns out theres more to reading a delimited file than splitting at the delimiter…
In a previous article, I described how to use LINQ when parsing a textfile.
Following that train of thoughts further, I found a more elegant way of splitting the lines from the file into columns. Creating extension methods on top of IEnumerable<string> seems like a good idea! Something that could be used like this for a [...]
Reading and parsing files is really no difficult task with the .NET framework. The System.IO namespace has several good classes to aid that task.
Comments