problem with string.Split delimeter

  • Thread starter Thread starter Ron
  • Start date Start date
R

Ron

I am trying to read a delimited textfile to the console
window as follows:

using System.IO;

StreamReader oRead;
string str1;
object[] str2;

oRead = new StreamReader(strPath + @"\testFile.txt");
str1 = oRead.ReadToEnd();
oRead.Close();
str2 = str1.Split((char)"\n"); //problem here
foreach(object v in str2)
{
Console.WriteLine(v.ToString());
}

The delimiter is a carriage return char. Basically, I am
trying to migrate a vb.net app to c#. Could someone point
out how to do this correctly?

Thanks,
Ron
 
Back
Top