FileSystemInfo Class

Provides the base class for both FileInfo and DirectoryInfo objects.

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)

Syntax

public abstract class FileSystemInfo

Remarks

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. Use this base class when parsing a lot of files and directories. 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 derived class can inherit from FileSystemInfo only if the derived class has the AllAccess permission from the FileIOPermissionAccess enumeration. In members that accept a path, the path can refer to a file or just a directory. The specified path can also refer to a relative path or a Universal Naming Convention (UNC) path for a server and share name. For example, all the following are acceptable paths:

  • "c:\\MyDir\\MyFile.txt" in C#
  • "c:\\MyDir" in C#
  • "MyDir\\MySubdir" in C#
  • "\\\\MyServer\\MyShare" in C#

Version Information

Available in the .NET Micro Framework versions 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

FileSystemInfo Members
System.IO Namespace