Name
DirectoryInfo
Synopsis
This class provides the same
functionality as Directory
, but in a
strongly typed, object-oriented manner. An instance of this type
represents a single directory.
This class extends FileSystemInfo
and implements all its
methods. In addition, it adds Parent
and Root
properties to
return the parent and root directories, respectively. Similarly, it
also supplies GetDirectories()
and GetFiles()
, to retrieve
its subdirectories and files, as well as GetFileSystemInfos()
,
which returns both the files and subdirectories contained by the
current directory. MoveTo()
allows you to
move a directory from one place to another.
Given the similarity between this type and the Directory
type, it may not be clear when one should be used in place of the
other. The key difference is the Directory
class
is a collection of shared utility functions, whereas a DirectoryInfo
object is an actual object, maintaining
state and identity in the classic style of all objects. (In fact, the DirectoryInfo
methods often map over to use the
corresponding Directory
methods.)
Public NotInheritable Class DirectoryInfo : Inherits FileSystemInfo ' Public Constructors Public Sub New( ByVal path As String) ' Public Instance Properties Overrides Public ReadOnly Property Exists As Boolean Overrides Public ReadOnly Property Name As String Public ReadOnly Property Parent As DirectoryInfo Public ReadOnly Property Root As DirectoryInfo ' Public Instance Methods Public Sub Create() Public Function CreateSubdirectory ...
Get VB.NET Core Classes in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.