using (Stream s = file.InputStream) { string[] numberOfUsers; var sr = new StreamReader(s); string contacts = sr.ReadToEnd(); contacts = contacts.Replace("\r\n", "\n"); string[] separateLines = contacts.ToString().Split('\n'); for (int i = 0; i <= ((separateLines.Length) - 1); i++) { numberOfUsers[i] = (separateLines[i + 1].ToString()).Split(','); }
foreach (string line in separateLines) { numberOfUsers = line.Split(','); // now you can go through the field foreach( string fieldOnLine in numberOfUsers ) { // process fieldOnLine here } }
separateLines[i + 1].ToString()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)