Ara :
HOME
ASP
PHP
JAVASCRIPT
C#
Add Code
Turkish
ASP Code Samples
PHP Code Samples
JavaScript Code Samples
C# Code Samples
C# Code Sample
C# Reading a Text File One Line at a Time
This example reads the contents of a text file by using the static methods ReadAllText and ReadAllLines from the System.IO.File class.
int counter = 0; string line; // Read the file and display it line by line. System.IO.StreamReader file = new System.IO.StreamReader("c:\\test.txt"); while((line = file.ReadLine()) != null) { Console.WriteLine (line); counter++; } file.Close();
Replace "c:\\test.txt" with the actual file name.
Added By : Administrator
Back to C# Code Samples
email :
info@kodornekleri.com