An ARFF (Attribute-Relation File Format). (and when the arff file is read again, the default value 0 is the index of a different string value. How to: Read From a Text File (C# Programming Guide); 2 minutes to read Contributors. In this article. This example reads the contents of a text file by using the static methods ReadAllText and ReadAllLines from the System.IO.File class.
This example reads the contents of a text file, one line at a time, into a string using the ReadLine
method of the StreamReader
class. Each text line is stored into the string line
and displayed on the screen.
Example
Compiling the Code
Copy the code and paste it into the Main
method of a console application.
Replace 'c:test.txt'
with the actual file name.
Robust Programming
The following conditions may cause an exception:
- The file may not exist.
Arff File Download
.NET Framework Security
Read File Arff In C#
Do not make decisions about the contents of the file based on the name of the file. For example, the file myFile.cs
may not be a C# source file.