I have a Console application that gets a filename passed as an argument. It then stores that filenames data to an array, gets opened and then read line by line and stored to another array.
I'm currently using the FileStream ReadLine() method to pull out the workstations one by one and store to this Array. The escape sequence is \r\n. However, if I receive a text file whereby the data has delimiters like a semi-colon (;) or commas (,) or whatever, I would like to change the code to allow me to handle these. What other class can I use to Open this file and retrieve and store data to array while handling / splitting out the escape sequences properly?
static void Main(string Args)
// Do Database Query Here.....
// This will hold the entire workstation
// list that is pulled from the Nodes table
List<Program> nodeList = new List<Program>();
string idx = "";
if (Args.Length >= 1)
for (int i = 0; i < Args.Length; i++)
idx = Args[i];
string filename = "";
filename = Args;
filename = filename.ToUpper();
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
using (StreamReader sr = new StreamReader(fs))
while ((line = sr.ReadLine()) != null)
Program node = new Program();
node.NodeToPing = line;