c# read file into list code example
Example 1: c# read text file to list string
List<string> lines = System.IO.File.ReadLines(completePath).ToList();
Example 2: c# read list
static void Main(string[] args)
{
List<string> AuthorList = new List<string>();
AuthorList.Add("Mahesh Chand");
AuthorList.Add("Praveen Kumar");
AuthorList.Add("Raj Kumar");
AuthorList.Add("Nipun Tomar");
AuthorList.Add("Dinesh Beniwal");
Console.WriteLine("Authors List");
foreach (var author in AuthorList)
{
Console.WriteLine(author);
}
}