using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string[] strfilepath = Directory.GetFiles(@"C:\test.txt"); List<string> list = new List<string>(); try { foreach (string FiletoRead in strfilepath) { System.IO.StreamReader file = new System.IO.StreamReader(FiletoRead); string read; while ((read = file.ReadLine()) != null) { string[] lineData = read.Split('|'); for (int i = 0; i < lineData.Length; i++) { list.Add(lineData[i]); } file.Close(); { Console.WriteLine("{0}", lineData[0]); Console.Read(); } } } } catch(Exception) { Console.WriteLine("No File"); } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)