Both
DirectoryInfo
and
FileInfo
inherit from
FileSystemInfo
, which provides
the Attributes
property[
^].
NB: Neither class has a
GetAttributes
method. Perhaps you're thinking of
File.GetAttributes[
^], which works for files or directories. But that works with paths represented as strings, not
FileInfo
/
DirectoryInfo
instances.
NB2: The attributes are only part of the story as to whether a file or directory is accessible. For example, on an NTFS drive, the
DACL[
^] might not allow the current user to access the object.