RecentIy I needed to find a specific TreeNode in a TreeView control. I expected that would be easy with LINQ, but quickly realized that there is no method in the .NET framework that will let me traverse all nodes of a hierarchy. I decided to create one myself. Continue reading “Traverse a hierarchical structure with LINQ-to-Hierarchical”
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… Continue reading “The trouble with delimited”
June 3., I’m speaking at this event: Microsoft Norway offers a free one-day course in ASP.NET.
(The course is presented in Norwegian.)
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 comma-separated file:
from columns in reader.AsEnumerable().AsDelimited(delimiter) select ...
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. Continue reading “Parsing textfiles with LINQ (or LINQ-to-TextReader)”