The String[] type's
.ToString()
method does not automatically concatentate all of the elements of the string. In fact, this is just the default
Object.ToString()
method which just returns the name of the type.
Try this:
foreach (FileInfo fi in dir.GetFiles())
{
using (StreamWriter writer = new StreamWriter(@"C:\log.txt", true))
{
string[] lines = File.ReadAllLines(fi.FullName);
foreach (string line in lines)
{
string[] words = line.Split(new Char[] { ' ' }, 2);
writer.WriteLine(words[0] + '\t' + words[1]);
}
}
}