Input/Output 4: FileInfo
Written by:
, 2009-04-16 21:25:24
The Basics
The File class has static methods that can be conveniently used without having to have an instance of a File object; however, those methods always perform security checks that adversely affect performance. The FileInfo class provides similar methods for similar tasks, but without security checks. You should use FileInfo if you are going to access a file several times. Also, unlike File, methods in FileInfo are instance methods. To create a FileInfo object, pass a valid file path to its constructor. The Create method, for example, behaves like the Create method of the File class. For instance, the following code uses the FileInfo class to create a file:
FileInfo fileInfo = new FileInfo("C:/NextGen.txt");
FileStream fs = fileInfo.Create();
Source:
http://www.ondotnet.com/pub/a/dotnet/2002/08/05/io.html?page=2