Share via


FileSystemInfo Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Provides the base class for both FileInfo and DirectoryInfo objects.

Inheritance Hierarchy

System. . :: . .Object
  System. . :: . .MarshalByRefObject
    System.IO..::..FileSystemInfo
      System.IO. . :: . .DirectoryInfo
      System.IO. . :: . .FileInfo

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

Syntax

'Declaration
Public MustInherit Class FileSystemInfo _
    Inherits MarshalByRefObject
public abstract class FileSystemInfo : MarshalByRefObject
public ref class FileSystemInfo abstract : public MarshalByRefObject
[<AbstractClass>]
type FileSystemInfo =  
    class
        inherit MarshalByRefObject
    end
public abstract class FileSystemInfo extends MarshalByRefObject

The FileSystemInfo type exposes the following members.

Constructors

  Name Description
Protected method FileSystemInfo Initializes a new instance of the FileSystemInfo class.

Top

Properties

  Name Description
Public property Attributes Gets or sets the attributes for the current file or directory.
Public property CreationTime Gets or sets the creation time of the current file or directory.
Public property CreationTimeUtc Gets or sets the creation time, in coordinated universal time (UTC), of the current file or directory.
Public property Exists Gets a value indicating whether the file or directory exists.
Public property Extension Gets the string representing the extension part of the file.
Public property FullName Gets the full path of the directory or file.
Public property LastAccessTime Gets or sets the time the current file or directory was last accessed.
Public property LastAccessTimeUtc Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was last accessed.
Public property LastWriteTime Gets or sets the time when the current file or directory was last written to.
Public property LastWriteTimeUtc Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.
Public property 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.

Top

Methods

  Name Description
Public method Delete Deletes a file or directory.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Refresh Refreshes the state of the object.
Protected method RefreshIfNull If information from the native file system has not yet been retrieved, retrieves it.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Fields

  Name Description
Protected field m_fullPath Represents the fully qualified path of the directory or file.

Top

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.

A derived class can inherit from FileSystemInfo only if the derived class has the AllAccess permission from the FileIOPermissionAccess enumeration.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.IO Namespace