Working with Files and Directories using ASP.NET
page 8 of 8
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 54953/ 107


The FileInfo and DirectoryInfo classes enable us to work with a single file or directory.  For the most part they provide equivalent functionality to File and Directory classes, which provide static methods for enumerating Files and Directories, but deal with a single object.

Because all Directory methods and File methods are static, it might be more efficient to use a Directory method and File method rather than a corresponding DirectoryInfo instance method and FileInfo instance method if you want to perform only one action.  Most Directory methods require the path to the directory that you are manipulating and all File methods require the path to the file that you are manipulating.

The static methods of the Directory class and File class perform security checks on all methods. Instance methods of DirectoryInfo class and FileInfo class should be considered instead of the corresponding static methods of the Directory class and File class in case you are going to reuse an object several times and avoiding the overhead of the security checks.

View Entire Article

User Comments

No comments posted yet.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-05-18 3:45:19 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search