0% found this document useful (0 votes)
5 views

complete-reference-vb_net_47

Uploaded by

khalid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

complete-reference-vb_net_47

Uploaded by

khalid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

DirectoryInfo

LastAccessTime (p) Gets or sets the time the current file or directory was last accessed
LastWriteTime (p) Gets or sets the time when the current file or directory was last written to
Length (p) Gets the size of the current file or directory
Name (p) Gets the name of the file
AppendText Creates a StreamWriter that appends text to the file represented by this
instance of the FileInfo
CopyTo Copies an existing file to a new file
Create Creates a file
CreateText Creates a StreamWriter that writes a new text file
Delete Permanently deletes a file
MoveTo Moves a specified file to a new location, providing the option to specify
a new filename
Open Opens a file with various read/write and sharing privileges
OpenRead Creates a read−only FileStream
OpenText Creates a StreamReader with UTF8 encoding that reads from an
existing text file
OpenWrite Creates a write−only FileStream
Refresh Refreshes the state of the object
Apart from the semantic differences, the reduction in security checks, and a few additional members like
Refresh and Length, this class provides the same operations on files as the File class. As I said, if you get
more utility out of a file system object and prefer to stick with a .NET file handling class, then use FileInfo
over the legacy FSO.

Also, the same exception raised for File problems applies to FileInfo problems, especially malformed paths
and file information.

DirectoryInfo

Table 15−18 lists the methods and properties of the DirectoryInfo class. This class can be instantiated and its
members are instance members. Instantiation gets you access to a useful collection of properties that provide
information such as file extensions, parent directory names, root folders, and so on.

Table 15−18: The Instance Members of the DirectoryInfo Object

Member Purpose
Attributes (p) Retrieves or changes the FileAttributes of the current resource
CreationTime (p) Retrieves or changes the creation time of the current resource
Exists (p) Retrieves or changes a value indicating whether the directory exists
Extension (p) Retrieves or changes the string representing the extension part of the file
FullName (p) Retrieves the full path of the directory or file
LastAccessTime (p) Retrieves or changes the time the current file or directory was last
accessed
LastWriteTime (p) Retrieves or changes the time when the current file or directory was last
written to

531

You might also like