FileSystemInfo Class
Provides the base class for both FileInfo & DirectoryInfo objects.
The FileSystemInfo class contains methods that are common to file and directory manipulation. A FileSystemInfo object can represent either a file or a directory, thus serving as the basis for FileInfo or DirectoryInfo objects.
When first called, FileSystemInfo calls Refresh and returns the cached information on APIs to get attributes and so on. On subsequent calls, you must call Refresh to get the latest copy of the information.
A derieved class can inherit from FileSystemInfo only if the derieved class has the AllAccess permission from the FileInfoPermissionAccess enumeration.
Common I/O Tasks are covered in detail here http://msdn2.microsoft.com/en-us/library/ms404278.aspx
Common Members
- Attributes (Gets/Sets the FileAttributes of the current FileSystemInfo).
- CreationTime (Gets/Sets the creation time of the current FileSystemInfo object).
- Exists (Gets a value indicating whether a file or directory exists).
- Extension (Gets the string representing the extension part of the file).
- FullName (Gets the full path of the directory or file).
- LastAccessTime (Gets/Sets the time the current file or directory was last accessed).
- LastWriteTime (Gets/Sets the time when the current file or directory was last written to).
- Name (For files, gets the name of the file. For directories, gets the name of the last directory in the hierarchy if a hierarchy exists. Otherwise, the Name property gets the name of the directory).
Controls the ability to access files & folders. This permission distinguishes between the following four types of file IO access provided by FileIOPermissionAccess enumeration.
- Read (Read access to the contents of the file or access to information about the file, such as its length or last modification time).
- Write (Write access to the contents of the file or access to change information about the file, such as its name. Also allows for deletion and overwriting).
- Append (Ability to write to the end of a file only. No ability to read).
- PathDiscovery (Access to the information in the path itself. This helps protect sensitive information in the path, such as user names, as well as information about the directory structure revealed in the the path. This value does not grant access to files or folders represented by the path).
No comments:
Post a Comment