Nevron Open Vision Documentation
Files

The NFile class contains properties and methods for working with files in a platform independent way. In most cases you will have to use one of the static methods of the NFile class, but whenever necessary you can also create an NFile instance by using the IO Service in order to get access to additional functionality like file size, file attributes, creation time, last access time, last write time and so on.

The methods of the NFile class are organized into two major categories:

File System

These following static methods of the NFile class aids you in working with the file system:

All of these methods are also available as instance methods of the NFile class.

The NFile class provides the following properties:

File Streams

The following static methods of the NFile class lets you create, read and write files:

The following example demonstrates how to read fully an UTF8 encoded text file:

Read File
Copy Code
string text;

using (Stream stream = NFile.OpenRead(@"C:\Documents\MyFile.txt"))
{
    byte[] data = NStreamHelpers.ReadToEnd(stream);
    text = NEncoding.UTF8.GetString(data);
}
See Also
Send Feedback