Click or drag to resize
FileInfo Class
Provides properties and instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects. This class cannot be inherited.
Inheritance Hierarchy
SystemObject
  SystemMarshalByRefObject
    System.IOFileSystemInfo
      System.IOFileInfo

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
[SerializableAttribute]
public sealed class FileInfo : FileSystemInfo

The FileInfo type exposes the following members.

Methods
  NameDescription
Public methodCreate
Creates a file.
Public methodDelete
Permanently deletes a file.
(Overrides FileSystemInfoDelete.)
Public methodEquals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodOpen(FileMode)
Opens a file in the specified mode.
Public methodOpen(FileMode, FileAccess)
Opens a file in the specified mode with read, write, or read/write access.
Public methodOpen(FileMode, FileAccess, FileShare)
Opens a file in the specified mode with read, write, or read/write access and the specified sharing option.
Public methodOpenRead
Creates a read-only FileStream.
Public methodOpenText
Creates a StreamReader with UTF8 encoding that reads from an existing text file.
Public methodOpenWrite
Creates a write-only FileStream.
Public methodRefresh
Refreshes the state of the object.
(Inherited from FileSystemInfo.)
Public methodToString
Returns the path as a string.
(Overrides ObjectToString.)
Top
Properties
  NameDescription
Public propertyExists
Gets a value indicating whether the file or directory exists.
(Inherited from FileSystemInfo.)
Public propertyExtension
Gets the string representing the extension part of the file.
(Inherited from FileSystemInfo.)
Public propertyFullName
Gets the full path of the directory or file.
(Inherited from FileSystemInfo.)
Public propertyName
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.
(Inherited from FileSystemInfo.)
Top
See Also