Input/Output 4: FileInfo
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();
Feel free to comment this article using a facebook profile.
I'm using facebook accounts for identification since even akismet couldn't handle all the spam I receive every day.