Reading a tab delimited text file in C#

On February 1, 2011, in Development, by Chris

Below is a sample using C# to read a tab delimited file

// use text reader to open tab delimited text file
using (TextReader tr = File.OpenText("TabDelimitedFile.txt"))
string line;
while ((line = tr.ReadLine()) != null)
// split the line of text into a collection
string[] items = line.Split('\t');

Tagged with: