Click here to Skip to main content
16,004,977 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day everyone ,
I need to learn by example search by streamreader line by line in textfile.
Posted
Updated 22-Dec-11 12:39pm

1 solution

you can use given code format
C#
int counter = 0;
string line;

// Read the file and display it line by line.
System.IO.StreamReader file =
   new System.IO.StreamReader("c:\\yourFile");
while((line = file.ReadLine()) != null)
{
   Console.WriteLine (line);
   counter++;
}

file.Close();
// Suspend the screen.
Console.ReadLine();


For more have a look there-[ Read a file line by line in C# .NET][^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900