TestableIO.System.IO.Abstractions.Wrappers
ACL (access control list) extension methods for .
Creates a directory and returns it, ensuring it is created with the specified directory security. If the directory already exists, the existing directory is returned.An object that determines the access control and audit security for the directory.The path of the directory to create. or is . is empty.Could not find a part of the path.Access to the path is denied.
Returns the security information of a directory.The security descriptors of all the access control sections of the directory.
Returns the security information of a directory.The security descriptors of all the access control sections of the directory.
Changes the security attributes of an existing directory.The security information to apply to the directory. is .
Exposes static methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
Exposes the underlying filesystem implementation. This is useful for implementing extension methods.
Creates all directories and subdirectories in the specified path unless they already exist.The directory to create.An object that represents the directory at the specified path. This object is returned regardless of whether a directory at the specified path already exists.The directory specified by is a file.
-or-
The network name is not known.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method.
-or-
is prefixed with, or contains, only a colon character (:). is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive). contains a colon character (:) that is not part of a drive label ("C:\").
Deletes an empty directory from a specified path.The name of the empty directory to remove. This directory must be writable and empty.A file with the same name and location specified by exists.
-or-
The directory is the application's current working directory.
-or-
The directory specified by is not empty.
-or-
The directory is read-only or contains a read-only file.
-or-
The directory is being used by another process.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method. is .The specified path, file name, or both exceed the system-defined maximum length. does not exist or could not be found.
-or-
The specified path is invalid (for example, it is on an unmapped drive).
Deletes the specified directory and, if indicated, any subdirectories and files in the directory.The name of the directory to remove. to remove directories, subdirectories, and files in ; otherwise, .A file with the same name and location specified by exists.
-or-
The directory specified by is read-only, or is and is not an empty directory.
-or-
The directory is the application's current working directory.
-or-
The directory contains a read-only file.
-or-
The directory is being used by another process.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method. is .The specified path, file name, or both exceed the system-defined maximum length. does not exist or could not be found.
-or-
The specified path is invalid (for example, it is on an unmapped drive).
Determines whether the given path refers to an existing directory on disk.The path to test. if refers to an existing directory; if the directory does not exist or an error occurs when trying to determine if the specified directory exists.
Gets the creation date and time of a directory.The path of the directory.A structure that is set to the creation date and time for the specified directory. This value is expressed in local time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method. is .The specified path, file name, or both exceed the system-defined maximum length.
Gets the creation date and time, in Coordinated Universal Time (UTC) format, of a directory.The path of the directory.A structure that is set to the creation date and time for the specified directory. This value is expressed in UTC time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method. is .The specified path, file name, or both exceed the system-defined maximum length.
Gets the current working directory of the application.A string that contains the absolute path of the current working directory, and does not end with a backslash (\).The caller does not have the required permission.The operating system is Windows CE, which does not have current directory functionality.
This method is available in the .NET Compact Framework, but is not currently supported.
Returns the names of subdirectories (including their paths) in the specified directory.The relative or absolute path to the directory to search. This string is not case-sensitive.An array of the full names (including paths) of subdirectories in the specified path, or an empty array if no directories are found.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method. is .The specified path, file name, or both exceed the system-defined maximum length. is a file name.The specified path is invalid (for example, it is on an unmapped drive).
Returns the names of subdirectories (including their paths) that match the specified search pattern in the specified directory.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of subdirectories in . This parameter can contain a combination of valid literal and wildcard characters, but it doesn't support regular expressions.An array of the full names (including paths) of the subdirectories that match the search pattern in the specified directory, or an empty array if no directories are found.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using .
-or-
doesn't contain a valid pattern. or is .The specified path, file name, or both exceed the system-defined maximum length. is a file name.The specified path is invalid (for example, it is on an unmapped drive).
Returns the names of the subdirectories (including their paths) that match the specified search pattern in the specified directory, and optionally searches subdirectories.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of subdirectories in . This parameter can contain a combination of valid literal and wildcard characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.An array of the full names (including paths) of the subdirectories that match the specified criteria, or an empty array if no directories are found. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. or is . is not a valid value.The caller does not have the required permission.The specified path, file name, or both exceed the system-defined maximum length. is a file name.The specified path is invalid (for example, it is on an unmapped drive).
Returns the volume information, root information, or both for the specified path.The path of a file or directory.A string that contains the volume information, root information, or both for the specified path.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with . is .The specified path, file name, or both exceed the system-defined maximum length.
Returns the names of files (including their paths) in the specified directory.The relative or absolute path to the directory to search. This string is not case-sensitive.An array of the full names (including paths) for the files in the specified directory, or an empty array if no files are found. is a file name.
-or-
A network error has occurred.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method. is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is not found or is invalid (for example, it is on an unmapped drive).
Returns the names of files (including their paths) that match the specified search pattern in the specified directory.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of files in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An array of the full names (including paths) for the files in the specified directory that match the specified search pattern, or an empty array if no files are found. is a file name.
-or-
A network error has occurred.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using .
-or-
doesn't contain a valid pattern. or is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is not found or is invalid (for example, it is on an unmapped drive).
Returns the names of files (including their paths) that match the specified search pattern in the specified directory, using a value to determine whether to search subdirectories.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of files in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.An array of the full names (including paths) for the files in the specified directory that match the specified search pattern and option, or an empty array if no files are found. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method.
-or-
does not contain a valid pattern. or is . is not a valid value.The caller does not have the required permission.The specified path is not found or is invalid (for example, it is on an unmapped drive).The specified path, file name, or both exceed the system-defined maximum length. is a file name.
-or-
A network error has occurred.
Returns the names of all files and subdirectories in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.An array of the names of files and subdirectories in the specified directory, or an empty array if no files or subdirectories are found.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with . is .The specified path, file name, or both exceed the system-defined maximum length. is a file name.The specified path is invalid (for example, it is on an unmapped drive).
Returns an array of file names and directory names that match a search pattern in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of file and directories in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An array of file names and directory names that match the specified search criteria, or an empty array if no files or directories are found.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method.
-or-
does not contain a valid pattern. or is .The specified path, file name, or both exceed the system-defined maximum length. is a file name.The specified path is invalid (for example, it is on an unmapped drive).
Returns an array of all the file names and directory names that match a search pattern in a specified path, and optionally searches subdirectories.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of files and directories in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or should include all subdirectories.
The default value is .An array of file the file names and directory names that match the specified search criteria, or an empty array if no files or directories are found. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. is .
-or-
is . is not a valid value. is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns the date and time the specified file or directory was last accessed.The file or directory for which to obtain access date and time information.A structure that is set to the date and time the specified file or directory was last accessed. This value is expressed in local time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The parameter is in an invalid format.
Returns the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last accessed.The file or directory for which to obtain access date and time information.A structure that is set to the date and time the specified file or directory was last accessed. This value is expressed in UTC time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The parameter is in an invalid format.
Returns the date and time the specified file or directory was last written to.The file or directory for which to obtain modification date and time information.A structure that is set to the date and time the specified file or directory was last written to. This value is expressed in local time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.
Returns the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last written to.The file or directory for which to obtain modification date and time information.A structure that is set to the date and time the specified file or directory was last written to. This value is expressed in UTC time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.
Retrieves the names of the logical drives on this computer in the form "<drive letter>:\".The logical drives on this computer.An I/O error occurred (for example, a disk error).The caller does not have the required permission.
Retrieves the parent directory of the specified path, including both absolute and relative paths.The path for which to retrieve the parent directory.The parent directory, or if is the root directory, including the root of a UNC server or share name.The directory specified by is read-only.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length. For more information, see the topic.The specified path was not found. is in an invalid format..NET Framework only: The caller does not have the required permissions.
Moves a file or a directory and its contents to a new location.The path of the file or directory to move.The path to the new location for . If is a file, then must also be a file name.An attempt was made to move a directory to a different volume.
-or-
already exists. See the Note in the Remarks section.
-or-
The and parameters refer to the same file or directory.
-or-
The directory or a file within it is being used by another process.The caller does not have the required permission. or is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. or is .The specified path, file name, or both exceed the system-defined maximum length.The path specified by is invalid (for example, it is on an unmapped drive).
Sets the creation date and time for the specified file or directory.The file or directory for which to set the creation date and time information.The date and time the file or directory was last written to. This value is expressed in local time.The specified path was not found. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission. specifies a value outside the range of dates or times permitted for this operation.The current operating system is not Windows NT or later.
Sets the creation date and time, in Coordinated Universal Time (UTC) format, for the specified file or directory.The file or directory for which to set the creation date and time information.The date and time the directory or file was created. This value is expressed in local time.The specified path was not found. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission. specifies a value outside the range of dates or times permitted for this operation.The current operating system is not Windows NT or later.
Sets the application's current working directory to the specified directory.The path to which the current working directory is set.An I/O error occurred. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission to access unmanaged code.The specified path was not found.The specified directory was not found.
Sets the date and time the specified file or directory was last accessed.The file or directory for which to set the access date and time information.An object that contains the value to set for the access date and time of . This value is expressed in local time.The specified path was not found. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission.The current operating system is not Windows NT or later. specifies a value outside the range of dates or times permitted for this operation.
Sets the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last accessed.The file or directory for which to set the access date and time information.An object that contains the value to set for the access date and time of . This value is expressed in UTC time.The specified path was not found. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission.The current operating system is not Windows NT or later. specifies a value outside the range of dates or times permitted for this operation.
Sets the date and time a directory was last written to.The path of the directory.The date and time the directory was last written to. This value is expressed in local time. was not found (for example, the directory doesn't exist or it is on an unmapped drive). was not found (for example, the directory doesn't exist or it is on an unmapped drive). is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission.The current operating system is not Windows NT or later. specifies a value outside the range of dates or times permitted for this operation.
Sets the date and time, in Coordinated Universal Time (UTC) format, that a directory was last written to.The path of the directory.The date and time the directory was last written to. This value is expressed in UTC time. was not found (for example, the directory doesn't exist or it is on an unmapped drive). was not found (for example, the directory doesn't exist or it is on an unmapped drive). is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission.The current operating system is not Windows NT or later. specifies a value outside the range of dates or times permitted for this operation.
Returns an enumerable collection of directory names in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.An enumerable collection of the full names (including paths) for the directories in the directory specified by . is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method. is . is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of directory names that match a search pattern in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of directories in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An enumerable collection of the full names (including paths) for the directories in the directory specified by and that match the specified search pattern. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters with the method.
-or-
does not contain a valid pattern. is .
-or-
is . is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of directory names that match a search pattern in a specified path, and optionally searches subdirectories.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of directories in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or should include all subdirectories.
The default value is .An enumerable collection of the full names (including paths) for the directories in the directory specified by and that match the specified search pattern and option. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. is .
-or-
is . is not a valid value. is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of file names in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.An enumerable collection of the full names (including paths) for the files in the directory specified by . is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method. is . is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of file names that match a search pattern in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of files in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An enumerable collection of the full names (including paths) for the files in the directory specified by and that match the specified search pattern. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. is .
-or-
is . is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of file names that match a search pattern in a specified path, and optionally searches subdirectories.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of files in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or should include all subdirectories.
The default value is .An enumerable collection of the full names (including paths) for the files in the directory specified by and that match the specified search pattern and option. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. is .
-or-
is . is not a valid value. is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of file names and directory names in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.An enumerable collection of file-system entries in the directory specified by . is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method. is . is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of file names and directory names that match a search pattern in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of file-system entries in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An enumerable collection of file-system entries in the directory specified by and that match the specified search pattern. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. is .
-or-
is . is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of file names and directory names that match a search pattern in a specified path, and optionally searches subdirectories.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against file-system entries in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or should include all subdirectories.
The default value is .An enumerable collection of file-system entries in the directory specified by and that match the specified search pattern and option. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. is .
-or-
is . is not a valid value. is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
ACL (access control list) extension methods for .
Creates a new directory, ensuring it is created with the specified directory security. If the directory already exists, nothing is done.A directory that does not exist yet that will be created by the method.The access control and audit security for the directory. or is .Could not find a part of the path.Access to the path is denied.
Returns the security information of a directory.The existing directory from which to obtain the security information.The security descriptors of all the access control sections of the directory.
Returns the security information of a directory.An existing directory from which to obtain the security information.The desired access control sections to retrieve.The security descriptors of the specified access control sections of the directory.
Changes the security attributes of an existing directory.An existing directory.The security information to apply to the directory. is .
Exposes instance methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
Creates a directory.The directory cannot be created.
Creates a subdirectory or subdirectories on the specified path. The specified path can be relative to this instance of the class.The specified path. This cannot be a different disk volume or Universal Naming Convention (UNC) name.The last directory specified in . does not specify a valid file path or contains invalid characters. is .The specified path is invalid, such as being on an unmapped drive.The subdirectory cannot be created.
-or-
A file or directory already has the name specified by .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have code access permission to create the directory.
-or-
The caller does not have code access permission to read the directory described by the returned object. This can occur when the parameter describes an existing directory. contains a colon character (:) that is not part of a drive label ("C:\").
Deletes this instance of a , specifying whether to delete subdirectories and files. to delete this directory, its subdirectories, and all files; otherwise, .The directory contains a read-only file.The directory described by this object does not exist or could not be found.The directory is read-only.
-or-
The directory contains one or more files or subdirectories and is .
-or-
The directory is the application's current working directory.
-or-
There is an open handle on the directory or on one of its files, and the operating system is Windows XP or earlier. This open handle can result from enumerating directories and files. For more information, see How to: Enumerate Directories and Files.The caller does not have the required permission.
Returns an enumerable collection of directory information in the current directory.An enumerable collection of directories in the current directory.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of directory information that matches a specified search pattern.The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An enumerable collection of directories that matches . is .The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of directory information that matches a specified search pattern and search subdirectory option.The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. The default value is .An enumerable collection of directories that matches and . is . is not a valid value.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of file information in the current directory.An enumerable collection of the files in the current directory.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of file information that matches a search pattern.The search string to match against the names of files. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An enumerable collection of files that matches . is .The path encapsulated in the object is invalid, (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of file information that matches a specified search pattern and search subdirectory option.The search string to match against the names of files. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. The default value is .An enumerable collection of files that matches and . is . is not a valid value.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of file system information in the current directory.An enumerable collection of file system information in the current directory.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of file system information that matches a specified search pattern.The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An enumerable collection of file system information objects that matches . is .The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of file system information that matches a specified search pattern and search subdirectory option.The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. The default value is .An enumerable collection of file system information objects that matches and . is . is not a valid value.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns the subdirectories of the current directory.An array of objects.The path encapsulated in the object is invalid, such as being on an unmapped drive.The caller does not have the required permission.The caller does not have the required permission.
Returns an array of directories in the current matching the given search criteria.The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An array of type matching . contains one or more invalid characters defined by the method. is .The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an array of directories in the current matching the given search criteria and using a value to determine whether to search subdirectories.The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.An array of type matching . contains one or more invalid characters defined by the method. is . is not a valid value.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns a file list from the current directory matching the given search pattern.An array of type . contains one or more invalid characters defined by the method. is .The path is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns a file list from the current directory matching the given search pattern.The search string to match against the names of files. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An array of type . contains one or more invalid characters defined by the method. is .The path is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns a file list from the current directory matching the given search pattern and using a value to determine whether to search subdirectories.The search string to match against the names of files. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.An array of type . contains one or more invalid characters defined by the method. is . is not a valid value.The path is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an array of strongly typed entries representing all the files and subdirectories in a directory.An array of strongly typed entries.The path is invalid (for example, it is on an unmapped drive).
Retrieves an array of strongly typed objects representing the files and subdirectories that match the specified search criteria.The search string to match against the names of directories and files. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An array of strongly typed objects matching the search criteria. contains one or more invalid characters defined by the method. is .The specified path is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Retrieves an array of objects that represent the files and subdirectories matching the specified search criteria.The search string to match against the names of directories and files. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. The default value is .An array of file system entries that match the search criteria. contains one or more invalid characters defined by the method. is . is not a valid value.The specified path is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Moves a instance and its contents to a new path.The name and path to which to move this directory. The destination cannot be another disk volume or a directory with the identical name. It can be an existing directory to which you want to add this directory as a subdirectory. is . is an empty string (''").An attempt was made to move a directory to a different volume.
-or-
already exists.
-or-
You are not authorized to access this path.
-or-
The directory being moved and the destination directory have the same name.The caller does not have the required permission.The destination directory cannot be found.
Gets the parent directory of a specified subdirectory.The parent directory, or if the path is null or if the file path denotes a root (such as "\", "C:", or * "\\server\share").The caller does not have the required permission.
Gets the root portion of the directory.An object that represents the root of the directory.The caller does not have the required permission.
Exposes instance methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
Deletes a file or directory.The specified path is invalid; for example, it is on an unmapped drive.There is an open handle on the file or directory, and the operating system is Windows XP or earlier. This open handle can result from enumerating directories and files. For more information, see How to: Enumerate Directories and Files.
Refreshes the state of the object.A device such as a disk drive is not ready.
Gets or sets the attributes for the current file or directory. of the current .The specified file doesn't exist. Only thrown when setting the property value.The specified path is invalid. For example, it's on an unmapped drive. Only thrown when setting the property value.The caller doesn't have the required permission.The caller attempts to set an invalid file attribute.
-or-
The user attempts to set an attribute value but doesn't have write permission. cannot initialize the data.
Gets or sets the creation time of the current file or directory.The creation date and time of the current object. cannot initialize the data.The specified path is invalid; for example, it is on an unmapped drive.The current operating system is not Windows NT or later.The caller attempts to set an invalid creation time.
Gets or sets the creation time, in coordinated universal time (UTC), of the current file or directory.The creation date and time in UTC format of the current object. cannot initialize the data.The specified path is invalid; for example, it is on an unmapped drive.The current operating system is not Windows NT or later.The caller attempts to set an invalid access time.
Gets a value indicating whether the file or directory exists. if the file or directory exists; otherwise, .
Gets the string representing the extension part of the file.A string containing the extension.
Gets the full path of the directory or file.A string containing the full path.The fully qualified path and file name exceed the system-defined maximum length.The caller does not have the required permission.
Gets or sets the time the current file or directory was last accessed.The time that the current file or directory was last accessed. cannot initialize the data.The current operating system is not Windows NT or later.The caller attempts to set an invalid access time
Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was last accessed.The UTC time that the current file or directory was last accessed. cannot initialize the data.The current operating system is not Windows NT or later.The caller attempts to set an invalid access time.
Gets or sets the time when the current file or directory was last written to.The time the current file was last written. cannot initialize the data.The current operating system is not Windows NT or later.The caller attempts to set an invalid write time.
Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.The UTC time when the current file was last written to. cannot initialize the data.The current operating system is not Windows NT or later.The caller attempts to set an invalid write time.
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 property gets the name of the directory.A string that is the name of the parent directory, the name of the last directory in the hierarchy, or the name of a file, including the file name extension.
Creates a directory.The directory cannot be created.
Creates a subdirectory or subdirectories on the specified path. The specified path can be relative to this instance of the class.The specified path. This cannot be a different disk volume or Universal Naming Convention (UNC) name.The last directory specified in . does not specify a valid file path or contains invalid characters. is .The specified path is invalid, such as being on an unmapped drive.The subdirectory cannot be created.
-or-
A file or directory already has the name specified by .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have code access permission to create the directory.
-or-
The caller does not have code access permission to read the directory described by the returned object. This can occur when the parameter describes an existing directory. contains a colon character (:) that is not part of a drive label ("C:\").
Deletes this instance of a , specifying whether to delete subdirectories and files. to delete this directory, its subdirectories, and all files; otherwise, .The directory contains a read-only file.The directory described by this object does not exist or could not be found.The directory is read-only.
-or-
The directory contains one or more files or subdirectories and is .
-or-
The directory is the application's current working directory.
-or-
There is an open handle on the directory or on one of its files, and the operating system is Windows XP or earlier. This open handle can result from enumerating directories and files. For more information, see How to: Enumerate Directories and Files.The caller does not have the required permission.
Returns an enumerable collection of directory information in the current directory.An enumerable collection of directories in the current directory.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of directory information that matches a specified search pattern.The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An enumerable collection of directories that matches . is .The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of directory information that matches a specified search pattern and search subdirectory option.The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. The default value is .An enumerable collection of directories that matches and . is . is not a valid value.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of file information in the current directory.An enumerable collection of the files in the current directory.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of file information that matches a search pattern.The search string to match against the names of files. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An enumerable collection of files that matches . is .The path encapsulated in the object is invalid, (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of file information that matches a specified search pattern and search subdirectory option.The search string to match against the names of files. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. The default value is .An enumerable collection of files that matches and . is . is not a valid value.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of file system information in the current directory.An enumerable collection of file system information in the current directory.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of file system information that matches a specified search pattern.The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An enumerable collection of file system information objects that matches . is .The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an enumerable collection of file system information that matches a specified search pattern and search subdirectory option.The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. The default value is .An enumerable collection of file system information objects that matches and . is . is not a valid value.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns the subdirectories of the current directory.An array of objects.The path encapsulated in the object is invalid, such as being on an unmapped drive.The caller does not have the required permission.The caller does not have the required permission.
Returns an array of directories in the current matching the given search criteria.The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An array of type matching . contains one or more invalid characters defined by the method. is .The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an array of directories in the current matching the given search criteria and using a value to determine whether to search subdirectories.The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.An array of type matching . contains one or more invalid characters defined by the method. is . is not a valid value.The path encapsulated in the object is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns a file list from the current directory matching the given search pattern.An array of type . contains one or more invalid characters defined by the method. is .The path is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns a file list from the current directory matching the given search pattern.The search string to match against the names of files. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An array of type . contains one or more invalid characters defined by the method. is .The path is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns a file list from the current directory matching the given search pattern and using a value to determine whether to search subdirectories.The search string to match against the names of files. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.An array of type . contains one or more invalid characters defined by the method. is . is not a valid value.The path is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Returns an array of strongly typed entries representing all the files and subdirectories in a directory.An array of strongly typed entries.The path is invalid (for example, it is on an unmapped drive).
Retrieves an array of strongly typed objects representing the files and subdirectories that match the specified search criteria.The search string to match against the names of directories and files. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An array of strongly typed objects matching the search criteria. contains one or more invalid characters defined by the method. is .The specified path is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Retrieves an array of objects that represent the files and subdirectories matching the specified search criteria.The search string to match against the names of directories and files. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. The default value is .An array of file system entries that match the search criteria. contains one or more invalid characters defined by the method. is . is not a valid value.The specified path is invalid (for example, it is on an unmapped drive).The caller does not have the required permission.
Moves a instance and its contents to a new path.The name and path to which to move this directory. The destination cannot be another disk volume or a directory with the identical name. It can be an existing directory to which you want to add this directory as a subdirectory. is . is an empty string (''").An attempt was made to move a directory to a different volume.
-or-
already exists.
-or-
You are not authorized to access this path.
-or-
The directory being moved and the destination directory have the same name.The caller does not have the required permission.The destination directory cannot be found.
Gets the parent directory of a specified subdirectory.The parent directory, or if the path is null or if the file path denotes a root (such as "\", "C:", or * "\\server\share").The caller does not have the required permission.
Gets the root portion of the directory.An object that represents the root of the directory.The caller does not have the required permission.
Returns a string that represents the current object.A string that represents the current object.
Gets a access control object that encapsulates the access control list (ACL) entries for the file or directory in the file system.
Gets a access control object that encapsulates the access control list (ACL) entries for the file or directory in the file system.
One of the values that specifies the type of access control list (ACL) information to receive.
Applies access control list (ACL) entries described by the object to the file or directory in the file system.
Exposes static methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
Creates all directories and subdirectories in the specified path unless they already exist.The directory to create.An object that represents the directory at the specified path. This object is returned regardless of whether a directory at the specified path already exists.The directory specified by is a file.
-or-
The network name is not known.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method.
-or-
is prefixed with, or contains, only a colon character (:). is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive). contains a colon character (:) that is not part of a drive label ("C:\").
Deletes an empty directory from a specified path.The name of the empty directory to remove. This directory must be writable and empty.A file with the same name and location specified by exists.
-or-
The directory is the application's current working directory.
-or-
The directory specified by is not empty.
-or-
The directory is read-only or contains a read-only file.
-or-
The directory is being used by another process.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method. is .The specified path, file name, or both exceed the system-defined maximum length. does not exist or could not be found.
-or-
The specified path is invalid (for example, it is on an unmapped drive).
Deletes the specified directory and, if indicated, any subdirectories and files in the directory.The name of the directory to remove. to remove directories, subdirectories, and files in ; otherwise, .A file with the same name and location specified by exists.
-or-
The directory specified by is read-only, or is and is not an empty directory.
-or-
The directory is the application's current working directory.
-or-
The directory contains a read-only file.
-or-
The directory is being used by another process.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method. is .The specified path, file name, or both exceed the system-defined maximum length. does not exist or could not be found.
-or-
The specified path is invalid (for example, it is on an unmapped drive).
Determines whether the given path refers to an existing directory on disk.The path to test. if refers to an existing directory; if the directory does not exist or an error occurs when trying to determine if the specified directory exists.
Gets the creation date and time of a directory.The path of the directory.A structure that is set to the creation date and time for the specified directory. This value is expressed in local time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method. is .The specified path, file name, or both exceed the system-defined maximum length.
Gets the creation date and time, in Coordinated Universal Time (UTC) format, of a directory.The path of the directory.A structure that is set to the creation date and time for the specified directory. This value is expressed in UTC time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method. is .The specified path, file name, or both exceed the system-defined maximum length.
Gets the current working directory of the application.A string that contains the absolute path of the current working directory, and does not end with a backslash (\).The caller does not have the required permission.The operating system is Windows CE, which does not have current directory functionality.
This method is available in the .NET Compact Framework, but is not currently supported.
Returns the names of subdirectories (including their paths) in the specified directory.The relative or absolute path to the directory to search. This string is not case-sensitive.An array of the full names (including paths) of subdirectories in the specified path, or an empty array if no directories are found.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method. is .The specified path, file name, or both exceed the system-defined maximum length. is a file name.The specified path is invalid (for example, it is on an unmapped drive).
Returns the names of subdirectories (including their paths) that match the specified search pattern in the specified directory.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of subdirectories in . This parameter can contain a combination of valid literal and wildcard characters, but it doesn't support regular expressions.An array of the full names (including paths) of the subdirectories that match the search pattern in the specified directory, or an empty array if no directories are found.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using .
-or-
doesn't contain a valid pattern. or is .The specified path, file name, or both exceed the system-defined maximum length. is a file name.The specified path is invalid (for example, it is on an unmapped drive).
Returns the names of the subdirectories (including their paths) that match the specified search pattern in the specified directory, and optionally searches subdirectories.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of subdirectories in . This parameter can contain a combination of valid literal and wildcard characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.An array of the full names (including paths) of the subdirectories that match the specified criteria, or an empty array if no directories are found. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. or is . is not a valid value.The caller does not have the required permission.The specified path, file name, or both exceed the system-defined maximum length. is a file name.The specified path is invalid (for example, it is on an unmapped drive).
Returns the volume information, root information, or both for the specified path.The path of a file or directory.A string that contains the volume information, root information, or both for the specified path.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with . is .The specified path, file name, or both exceed the system-defined maximum length.
Returns the names of files (including their paths) in the specified directory.The relative or absolute path to the directory to search. This string is not case-sensitive.An array of the full names (including paths) for the files in the specified directory, or an empty array if no files are found. is a file name.
-or-
A network error has occurred.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the method. is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is not found or is invalid (for example, it is on an unmapped drive).
Returns the names of files (including their paths) that match the specified search pattern in the specified directory.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of files in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An array of the full names (including paths) for the files in the specified directory that match the specified search pattern, or an empty array if no files are found. is a file name.
-or-
A network error has occurred.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using .
-or-
doesn't contain a valid pattern. or is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is not found or is invalid (for example, it is on an unmapped drive).
Returns the names of files (including their paths) that match the specified search pattern in the specified directory, using a value to determine whether to search subdirectories.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of files in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.An array of the full names (including paths) for the files in the specified directory that match the specified search pattern and option, or an empty array if no files are found. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method.
-or-
does not contain a valid pattern. or is . is not a valid value.The caller does not have the required permission.The specified path is not found or is invalid (for example, it is on an unmapped drive).The specified path, file name, or both exceed the system-defined maximum length. is a file name.
-or-
A network error has occurred.
Returns the names of all files and subdirectories in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.An array of the names of files and subdirectories in the specified directory, or an empty array if no files or subdirectories are found.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with . is .The specified path, file name, or both exceed the system-defined maximum length. is a file name.The specified path is invalid (for example, it is on an unmapped drive).
Returns an array of file names and directory names that match a search pattern in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of file and directories in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An array of file names and directory names that match the specified search criteria, or an empty array if no files or directories are found.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method.
-or-
does not contain a valid pattern. or is .The specified path, file name, or both exceed the system-defined maximum length. is a file name.The specified path is invalid (for example, it is on an unmapped drive).
Returns an array of all the file names and directory names that match a search pattern in a specified path, and optionally searches subdirectories.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of files and directories in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or should include all subdirectories.
The default value is .An array of file the file names and directory names that match the specified search criteria, or an empty array if no files or directories are found. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. is .
-or-
is . is not a valid value. is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns the date and time the specified file or directory was last accessed.The file or directory for which to obtain access date and time information.A structure that is set to the date and time the specified file or directory was last accessed. This value is expressed in local time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The parameter is in an invalid format.
Returns the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last accessed.The file or directory for which to obtain access date and time information.A structure that is set to the date and time the specified file or directory was last accessed. This value is expressed in UTC time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The parameter is in an invalid format.
Returns the date and time the specified file or directory was last written to.The file or directory for which to obtain modification date and time information.A structure that is set to the date and time the specified file or directory was last written to. This value is expressed in local time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.
Returns the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last written to.The file or directory for which to obtain modification date and time information.A structure that is set to the date and time the specified file or directory was last written to. This value is expressed in UTC time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.
Retrieves the names of the logical drives on this computer in the form "<drive letter>:\".The logical drives on this computer.An I/O error occurred (for example, a disk error).The caller does not have the required permission.
Retrieves the parent directory of the specified path, including both absolute and relative paths.The path for which to retrieve the parent directory.The parent directory, or if is the root directory, including the root of a UNC server or share name.The directory specified by is read-only.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length. For more information, see the topic.The specified path was not found. is in an invalid format..NET Framework only: The caller does not have the required permissions.
Moves a file or a directory and its contents to a new location.The path of the file or directory to move.The path to the new location for . If is a file, then must also be a file name.An attempt was made to move a directory to a different volume.
-or-
already exists. See the Note in the Remarks section.
-or-
The and parameters refer to the same file or directory.
-or-
The directory or a file within it is being used by another process.The caller does not have the required permission. or is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. or is .The specified path, file name, or both exceed the system-defined maximum length.The path specified by is invalid (for example, it is on an unmapped drive).
Sets the creation date and time for the specified file or directory.The file or directory for which to set the creation date and time information.The date and time the file or directory was last written to. This value is expressed in local time.The specified path was not found. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission. specifies a value outside the range of dates or times permitted for this operation.The current operating system is not Windows NT or later.
Sets the creation date and time, in Coordinated Universal Time (UTC) format, for the specified file or directory.The file or directory for which to set the creation date and time information.The date and time the directory or file was created. This value is expressed in local time.The specified path was not found. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission. specifies a value outside the range of dates or times permitted for this operation.The current operating system is not Windows NT or later.
Sets the application's current working directory to the specified directory.The path to which the current working directory is set.An I/O error occurred. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission to access unmanaged code.The specified path was not found.The specified directory was not found.
Sets the date and time the specified file or directory was last accessed.The file or directory for which to set the access date and time information.An object that contains the value to set for the access date and time of . This value is expressed in local time.The specified path was not found. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission.The current operating system is not Windows NT or later. specifies a value outside the range of dates or times permitted for this operation.
Sets the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last accessed.The file or directory for which to set the access date and time information.An object that contains the value to set for the access date and time of . This value is expressed in UTC time.The specified path was not found. is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission.The current operating system is not Windows NT or later. specifies a value outside the range of dates or times permitted for this operation.
Sets the date and time a directory was last written to.The path of the directory.The date and time the directory was last written to. This value is expressed in local time. was not found (for example, the directory doesn't exist or it is on an unmapped drive). was not found (for example, the directory doesn't exist or it is on an unmapped drive). is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission.The current operating system is not Windows NT or later. specifies a value outside the range of dates or times permitted for this operation.
Sets the date and time, in Coordinated Universal Time (UTC) format, that a directory was last written to.The path of the directory.The date and time the directory was last written to. This value is expressed in UTC time. was not found (for example, the directory doesn't exist or it is on an unmapped drive). was not found (for example, the directory doesn't exist or it is on an unmapped drive). is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters with the method. is .The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission.The current operating system is not Windows NT or later. specifies a value outside the range of dates or times permitted for this operation.
Returns an enumerable collection of directory names in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.An enumerable collection of the full names (including paths) for the directories in the directory specified by . is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method. is . is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of directory names that match a search pattern in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of directories in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An enumerable collection of the full names (including paths) for the directories in the directory specified by and that match the specified search pattern. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters with the method.
-or-
does not contain a valid pattern. is .
-or-
is . is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of directory names that match a search pattern in a specified path, and optionally searches subdirectories.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of directories in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or should include all subdirectories.
The default value is .An enumerable collection of the full names (including paths) for the directories in the directory specified by and that match the specified search pattern and option. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. is .
-or-
is . is not a valid value. is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of file names in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.An enumerable collection of the full names (including paths) for the files in the directory specified by . is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method. is . is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of file names that match a search pattern in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of files in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An enumerable collection of the full names (including paths) for the files in the directory specified by and that match the specified search pattern. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. is .
-or-
is . is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of file names that match a search pattern in a specified path, and optionally searches subdirectories.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of files in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or should include all subdirectories.
The default value is .An enumerable collection of the full names (including paths) for the files in the directory specified by and that match the specified search pattern and option. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. is .
-or-
is . is not a valid value. is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of file names and directory names in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.An enumerable collection of file-system entries in the directory specified by . is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method. is . is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of file names and directory names that match a search pattern in a specified path.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against the names of file-system entries in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.An enumerable collection of file-system entries in the directory specified by and that match the specified search pattern. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. is .
-or-
is . is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Returns an enumerable collection of file names and directory names that match a search pattern in a specified path, and optionally searches subdirectories.The relative or absolute path to the directory to search. This string is not case-sensitive.The search string to match against file-system entries in . This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.One of the enumeration values that specifies whether the search operation should include only the current directory or should include all subdirectories.
The default value is .An enumerable collection of file-system entries in the directory specified by and that match the specified search pattern and option. is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the method.
-or-
does not contain a valid pattern. is .
-or-
is . is not a valid value. is invalid, such as referring to an unmapped drive. is a file name.The specified path, file name, or combined exceed the system-defined maximum length.The caller does not have the required permission.The caller does not have the required permission.
Provides access to information on a drive.
Provides access to information on a drive.
Exposes the underlying filesystem implementation. This is useful for implementing extension methods.
Indicates the amount of available free space on a drive, in bytes.The amount of free space available on the drive, in bytes.Access to the drive information is denied.An I/O error occurred (for example, a disk error or a drive was not ready).
Gets the name of the file system, such as NTFS or FAT32.The name of the file system on the specified drive.Access to the drive information is denied.The drive does not exist or is not mapped.An I/O error occurred (for example, a disk error or a drive was not ready).
Gets the drive type, such as CD-ROM, removable, network, or fixed.One of the enumeration values that specifies a drive type.
Gets a value that indicates whether a drive is ready. if the drive is ready; if the drive is not ready.
Gets the name of a drive, such as C:\.The name of the drive.
Gets the root directory of a drive.An object that contains the root directory of the drive.
Gets the total amount of free space available on a drive, in bytes.The total free space available on a drive, in bytes.Access to the drive information is denied.The drive is not mapped or does not exist.An I/O error occurred (for example, a disk error or a drive was not ready).
Gets the total size of storage space on a drive, in bytes.The total size of the drive, in bytes.Access to the drive information is denied.The drive is not mapped or does not exist.An I/O error occurred (for example, a disk error or a drive was not ready).
Gets or sets the volume label of a drive.The volume label.An I/O error occurred (for example, a disk error or a drive was not ready).The drive is not mapped or does not exist.The caller does not have the required permission.The volume label is being set on a network or CD-ROM drive.
-or-
Access to the drive information is denied.
Converts a into a .
The drive info to be converted.
The wrapper for a .
Initializes a new instance of the class, which acts as a wrapper for a drive info.
The underlying IFileSystem.
The drive info.
Gets or sets the name of a drive, such as C:\.
The name of the drive.
This property is the name assigned to the drive, such as C:\ or E:\.
Gets or sets the drive type, such as CD-ROM, removable, network, or fixed.
One of the enumeration values that specifies a drive type.
The DriveType property indicates whether a drive is one of the following: CDRom, Fixed, Network, NoRootDirectory, Ram, Removable, or Unknown.
These values are described in the DriveType enumeration.
Gets or sets the name of the file system, such as NTFS or FAT32.
Use DriveFormat to determine what formatting a drive uses.
The name of the file system on the specified drive.
Thrown if the access to the drive information is denied.
Thrown if the drive does not exist or is not mapped.
Thrown if an I/O error occurred (for example, a disk error or a drive was not ready).
Gets or sets a value indicating whether a drive is ready.
if the drive is ready; if the drive is not ready.
IsReady indicates whether a drive is ready.
For example, it indicates whether a CD is in a CD drive or whether a removable storage device is ready for read/write operations.
If you do not test whether a drive is ready, and it is not ready, querying the drive using will raise an IOException.
Do not rely on IsReady to avoid catching exceptions from other members such as TotalSize, TotalFreeSpace, and .
Between the time that your code checks IsReady and then accesses one of the other properties (even if the access occurs immediately after the check),
a drive may have been disconnected or a disk may have been removed.
Gets or sets the amount of available free space on a drive, in bytes.
The amount of free space available on the drive, in bytes.
This property indicates the amount of free space available on the drive.
Note that this number may be different from the TotalFreeSpace number because this property takes into account disk quotas.
Thrown if the access to the drive information is denied.
Thrown if an I/O error occurred (for example, a disk error or a drive was not ready).
Gets or sets the total amount of free space available on a drive, in bytes.
The total free space available on a drive, in bytes.
This property indicates the total amount of free space available on the drive, not just what is available to the current user.
Thrown if the access to the drive information is denied.
Thrown if the drive does not exist or is not mapped.
Thrown if an I/O error occurred (for example, a disk error or a drive was not ready).
Gets or sets the total size of storage space on a drive, in bytes.
The total size of the drive, in bytes.
This property indicates the total size of the drive in bytes, not just what is available to the current user.
Thrown if the access to the drive information is denied.
Thrown if the drive does not exist or is not mapped.
Thrown if an I/O error occurred (for example, a disk error or a drive was not ready).
Gets or sets the root directory of a drive.
An object that contains the root directory of the drive.
Gets or sets the volume label of a drive.
The volume label.
The label length is determined by the operating system. For example, NTFS allows a volume label to be up to 32 characters long. Note that is a valid VolumeLabel.
Thrown if an I/O error occurred (for example, a disk error or a drive was not ready).
Thrown if the drive does not exist or is not mapped.
Thrown if the caller does not have the required permission.
Thrown if the volume label is being set on a network or CD-ROM drive
-or-
Access to the drive information is denied.
Returns a string that represents the current object.A string that represents the current object.
ACL (access control list) extension methods for .
Returns the security information of a file.The security descriptors of all the access control sections of the file.
Returns the security information of a file.The desired access control sections to retrieve from the file.The security descriptors of the specified access control sections of the file.
Changes the security attributes of an existing file.The security information to apply to the file. is .
Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of objects.
Asynchronously appends lines to a file, and then closes the file. If the specified file does not exist, this method creates a file, writes the specified lines to the file, and then closes the file.The file to append the lines to. The file is created if it doesn't already exist.The lines to append to the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous append operation.
Asynchronously appends lines to a file by using a specified encoding, and then closes the file. If the specified file does not exist, this method creates a file, writes the specified lines to the file, and then closes the file.The file to append the lines to. The file is created if it doesn't already exist.The lines to append to the file.The character encoding to use.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous append operation.
Asynchronously opens a file or creates a file if it does not already exist, appends the specified string to the file, and then closes the file.The file to append the specified string to.The string to append to the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous append operation.
Asynchronously opens a file or creates the file if it does not already exist, appends the specified string to the file using the specified encoding, and then closes the file.The file to append the specified string to.The string to append to the file.The character encoding to use.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous append operation.
Asynchronously opens a binary file, reads the contents of the file into a byte array, and then closes the file.The file to open for reading.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous read operation, which wraps the byte array containing the contents of the file.
Asynchronously opens a text file, reads all lines of the file, and then closes the file.The file to open for reading.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous read operation, which wraps the string array containing all lines of the file.
Asynchronously opens a text file, reads all lines of the file with the specified encoding, and then closes the file.The file to open for reading.The encoding applied to the contents of the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous read operation, which wraps the string array containing all lines of the file.
Asynchronously opens a text file, reads all the text in the file, and then closes the file.The file to open for reading.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous read operation, which wraps the string containing all text in the file.
Asynchronously opens a text file, reads all text in the file with the specified encoding, and then closes the file.The file to open for reading.The encoding applied to the contents of the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous read operation, which wraps the string containing all text in the file.
Asynchronously creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.The file to write to.The bytes to write to the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous write operation.
Asynchronously creates a new file, writes the specified lines to the file, and then closes the file.The file to write to.The lines to write to the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous write operation.
Asynchronously creates a new file, write the specified lines to the file by using the specified encoding, and then closes the file.The file to write to.The lines to write to the file.The character encoding to use.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous write operation.
Asynchronously creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.The file to write to.The string to write to the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous write operation.
Asynchronously creates a new file, writes the specified string to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.The file to write to.The string to write to the file.The encoding to apply to the string.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous write operation.
Exposes the underlying filesystem implementation. This is useful for implementing extension methods.
Appends lines to a file, and then closes the file. If the specified file does not exist, this method creates a file, writes the specified lines to the file, and then closes the file.The file to append the lines to. The file is created if it doesn't already exist.The lines to append to the file. is a zero-length string, contains only white space, or contains one more invalid characters defined by the method.Either or is . is invalid (for example, the directory doesn't exist or it is on an unmapped drive).The file specified by was not found.An I/O error occurred while opening the file. exceeds the system-defined maximum length. is in an invalid format.The caller does not have permission to write to the file. specifies a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
is a directory.
Appends lines to a file by using a specified encoding, and then closes the file. If the specified file does not exist, this method creates a file, writes the specified lines to the file, and then closes the file.The file to append the lines to. The file is created if it doesn't already exist.The lines to append to the file.The character encoding to use. is a zero-length string, contains only white space, or contains one more invalid characters defined by the method.Either , , or is . is invalid (for example, the directory doesn't exist or it is on an unmapped drive).The file specified by was not found.An I/O error occurred while opening the file. exceeds the system-defined maximum length. is in an invalid format.The caller does not have the required permission. specifies a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
is a directory.
-or-
The caller does not have the required permission.
Opens a file, appends the specified string to the file, and then closes the file. If the file does not exist, this method creates a file, writes the specified string to the file, then closes the file.The file to append the specified string to.The string to append to the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, the directory doesn't exist or it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission. is in an invalid format.The caller does not have the required permission.
Appends the specified string to the file using the specified encoding, creating the file if it does not already exist.The file to append the specified string to.The string to append to the file.The character encoding to use. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, the directory doesn't exist or it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission. is in an invalid format.The caller does not have the required permission.
Creates a that appends UTF-8 encoded text to an existing file, or to a new file if the specified file does not exist.The path to the file to append to.A stream writer that appends UTF-8 encoded text to the specified file or to a new file.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, the directory doesn't exist or it is on an unmapped drive). is in an invalid format.
Copies an existing file to a new file. Overwriting a file of the same name is not allowed.The file to copy.The name of the destination file. This cannot be a directory or an existing file.The caller does not have the required permission. or is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
-or-
or specifies a directory. or is .The specified path, file name, or both exceed the system-defined maximum length.The path specified in or is invalid (for example, it is on an unmapped drive). was not found. exists.
-or-
An I/O error has occurred. or is in an invalid format.
Copies an existing file to a new file. Overwriting a file of the same name is allowed.The file to copy.The name of the destination file. This cannot be a directory. if the destination file can be overwritten; otherwise, .The caller does not have the required permission.
-or-
is read-only.
-or-
is , exists and is hidden, but is not hidden. or is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
-or-
or specifies a directory. or is .The specified path, file name, or both exceed the system-defined maximum length.The path specified in or is invalid (for example, it is on an unmapped drive). was not found. exists and is .
-or-
An I/O error has occurred. or is in an invalid format.
Creates or overwrites a file in the specified path.The path and name of the file to create.A that provides read/write access to the file specified in .The caller does not have the required permission.
-or-
specified a file that is read-only.
-or-
specified a file that is hidden. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while creating the file. is in an invalid format.
Creates or overwrites the specified file.The name of the file.The number of bytes buffered for reads and writes to the file.A with the specified buffer size that provides read/write access to the file specified in .The caller does not have the required permission.
-or-
specified a file that is read-only.
-or-
specified a file that is hidden. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while creating the file. is in an invalid format.
Creates or overwrites the specified file, specifying a buffer size and a value that describes how to create or overwrite the file.The name of the file.The number of bytes buffered for reads and writes to the file.One of the values that describes how to create or overwrite the file.A new file with the specified buffer size.The caller does not have the required permission.
-or-
specified a file that is read-only.
-or-
specified a file that is hidden. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive.An I/O error occurred while creating the file. is in an invalid format.
Creates or opens a file for writing UTF-8 encoded text. If the file already exists, its contents are overwritten.The file to be opened for writing.A that writes to the specified file using UTF-8 encoding.The caller does not have the required permission.
-or-
specified a file that is read-only.
-or-
specified a file that is hidden. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive). is in an invalid format.
Decrypts a file that was encrypted by the current account using the method.A path that describes a file to decrypt.The parameter is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .The parameter is .An invalid drive was specified.The file described by the parameter could not be found.An I/O error occurred while opening the file. For example, the encrypted file is already open.
-or-
This operation is not supported on the current platform.The specified path, file name, or both exceed the system-defined maximum length.The current operating system is not Windows NT or later.The file system is not NTFS.The parameter specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
The parameter specified a directory.
-or-
The caller does not have the required permission.
Deletes the specified file.The name of the file to be deleted. Wildcard characters are not supported. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path is invalid (for example, it is on an unmapped drive).The specified file is in use.
-or-
There is an open handle on the file, and the operating system is Windows XP or earlier. This open handle can result from enumerating directories and files. For more information, see How to: Enumerate Directories and Files. is in an invalid format.The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission.
-or-
The file is an executable file that is in use.
-or-
is a directory.
-or-
specified a read-only file.
Encrypts a file so that only the account used to encrypt the file can decrypt it.A path that describes a file to encrypt.The parameter is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .The parameter is .An invalid drive was specified.The file described by the parameter could not be found.An I/O error occurred while opening the file.
-or-
This operation is not supported on the current platform.The specified path, file name, or both exceed the system-defined maximum length.The current operating system is not Windows NT or later.The file system is not NTFS.The parameter specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
The parameter specified a directory.
-or-
The caller does not have the required permission.
Determines whether the specified file exists.The file to check. if the caller has the required permissions and contains the name of an existing file; otherwise, . This method also returns if is , an invalid path, or a zero-length string. If the caller does not have sufficient permissions to read the specified file, no exception is thrown and the method returns regardless of the existence of .
Gets the of the file on the path.The path to the file.The of the file on the path. is empty, contains only white spaces, or contains invalid characters.The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format. represents a file and is invalid, such as being on an unmapped drive, or the file cannot be found. represents a directory and is invalid, such as being on an unmapped drive, or the directory cannot be found.This file is being used by another process.The caller does not have the required permission.
Returns the creation date and time of the specified file or directory.The file or directory for which to obtain creation date and time information.A structure set to the creation date and time for the specified file or directory. This value is expressed in local time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.
Returns the creation date and time, in coordinated universal time (UTC), of the specified file or directory.The file or directory for which to obtain creation date and time information.A structure set to the creation date and time for the specified file or directory. This value is expressed in UTC time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.
Returns the date and time the specified file or directory was last accessed.The file or directory for which to obtain access date and time information.A structure set to the date and time that the specified file or directory was last accessed. This value is expressed in local time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.
Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last accessed.The file or directory for which to obtain access date and time information.A structure set to the date and time that the specified file or directory was last accessed. This value is expressed in UTC time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.
Returns the date and time the specified file or directory was last written to.The file or directory for which to obtain write date and time information.A structure set to the date and time that the specified file or directory was last written to. This value is expressed in local time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.
Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last written to.The file or directory for which to obtain write date and time information.A structure set to the date and time that the specified file or directory was last written to. This value is expressed in UTC time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.
Moves a specified file to a new location, providing the option to specify a new file name.The name of the file to move. Can include a relative or absolute path.The new path and name for the file.The destination file already exists.
-or-
was not found. or is . or is a zero-length string, contains only white space, or contains invalid characters as defined in .The caller does not have the required permission.The specified path, file name, or both exceed the system-defined maximum length.The path specified in or is invalid, (for example, it is on an unmapped drive). or is in an invalid format.
Opens a on the specified path with read/write access with no sharing.The file to open.A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.A opened in the specified mode and path, with read/write access and not shared. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid, (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.
-or-
is and the specified file is a hidden file. specified an invalid value.The file specified in was not found. is in an invalid format.
Opens a on the specified path, with the specified mode and access with no sharing.The file to open.A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.A value that specifies the operations that can be performed on the file.An unshared that provides access to the specified file, with the specified mode and access. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
-or-
specified and specified , , , or . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid, (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only and is not .
-or-
specified a directory.
-or-
The caller does not have the required permission.
-or-
is and the specified file is a hidden file. or specified an invalid value.The file specified in was not found. is in an invalid format.
Opens a on the specified path, having the specified mode with read, write, or read/write access and the specified sharing option.The file to open.A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.A value that specifies the operations that can be performed on the file.A value specifying the type of access other threads have to the file.A on the specified path, having the specified mode with read, write, or read/write access and the specified sharing option. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
-or-
specified and specified , , , or . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid, (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only and is not .
-or-
specified a directory.
-or-
The caller does not have the required permission.
-or-
is and the specified file is a hidden file., , or specified an invalid value.The file specified in was not found. is in an invalid format.
Opens an existing file for reading.The file to be opened for reading.A read-only on the specified path. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid, (for example, it is on an unmapped drive). specified a directory.
-or-
The caller does not have the required permission.The file specified in was not found. is in an invalid format.An I/O error occurred while opening the file.
Opens an existing UTF-8 encoded text file for reading.The file to be opened for reading.A on the specified path.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid, (for example, it is on an unmapped drive).The file specified in was not found. is in an invalid format.
Opens an existing file or creates a new file for writing.The file to be opened for writing.An unshared object on the specified path with access.The caller does not have the required permission.
-or-
specified a read-only file or directory. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid, (for example, it is on an unmapped drive). is in an invalid format.
Opens a binary file, reads the contents of the file into a byte array, and then closes the file.The file to open for reading.A byte array containing the contents of the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file.This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.The file specified in was not found. is in an invalid format.The caller does not have the required permission.
Opens a text file, reads all lines of the file, and then closes the file.The file to open for reading.A string array containing all lines of the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.The file specified in was not found. is in an invalid format.The caller does not have the required permission.
Opens a file, reads all lines of the file with the specified encoding, and then closes the file.The file to open for reading.The encoding applied to the contents of the file.A string array containing all lines of the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.The file specified in was not found. is in an invalid format.The caller does not have the required permission.
Opens a text file, reads all the text in the file, and then closes the file.The file to open for reading.A string containing all the text in the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.The file specified in was not found. is in an invalid format.The caller does not have the required permission.
Opens a file, reads all text in the file with the specified encoding, and then closes the file.The file to open for reading.The encoding applied to the contents of the file.A string containing all text in the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.The file specified in was not found. is in an invalid format.The caller does not have the required permission.
Reads the lines of a file.The file to read.All the lines of the file, or the lines that are the result of a query. is a zero-length string, contains only white space, or contains one or more invalid characters defined by the method. is . is invalid (for example, it is on an unmapped drive).The file specified by was not found.An I/O error occurred while opening the file. exceeds the system-defined maximum length.The caller does not have the required permission. specifies a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
is a directory.
-or-
The caller does not have the required permission.
Read the lines of a file that has a specified encoding.The file to read.The encoding that is applied to the contents of the file.All the lines of the file, or the lines that are the result of a query. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by the method. is . is invalid (for example, it is on an unmapped drive).The file specified by was not found.An I/O error occurred while opening the file. exceeds the system-defined maximum length.The caller does not have the required permission. specifies a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
is a directory.
-or-
The caller does not have the required permission.
Replaces the contents of a specified file with the contents of another file, deleting the original file, and creating a backup of the replaced file.The name of a file that replaces the file specified by .The name of the file being replaced.The name of the backup file.The path described by the parameter was not of a legal form.
-or-
The path described by the parameter was not of a legal form.The parameter is .An invalid drive was specified.The file described by the current object could not be found.
-or-
The file described by the parameter could not be found.An I/O error occurred while opening the file.
-or-
The and parameters specify the same file.The specified path, file name, or both exceed the system-defined maximum length.The operating system is Windows 98 Second Edition or earlier and the files system is not NTFS.The or parameter specifies a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
Source or destination parameters specify a directory instead of a file.
-or-
The caller does not have the required permission.
Replaces the contents of a specified file with the contents of another file, deleting the original file, and creating a backup of the replaced file and optionally ignores merge errors.The name of a file that replaces the file specified by .The name of the file being replaced.The name of the backup file. to ignore merge errors (such as attributes and access control lists (ACLs)) from the replaced file to the replacement file; otherwise, .The path described by the parameter was not of a legal form.
-or-
The path described by the parameter was not of a legal form.The parameter is .An invalid drive was specified.The file described by the current object could not be found.
-or-
The file described by the parameter could not be found.An I/O error occurred while opening the file.
-or-
The and parameters specify the same file.The specified path, file name, or both exceed the system-defined maximum length.The operating system is Windows 98 Second Edition or earlier and the files system is not NTFS.The or parameter specifies a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
Source or destination parameters specify a directory instead of a file.
-or-
The caller does not have the required permission.
Sets the specified of the file on the specified path.The path to the file.A bitwise combination of the enumeration values. is empty, contains only white spaces, contains invalid characters, or the file attribute is invalid.The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.The specified path is invalid, (for example, it is on an unmapped drive).The file cannot be found. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.
Sets the date and time the file was created.The file for which to set the creation date and time information.A containing the value to set for the creation date and time of . This value is expressed in local time.The specified path was not found. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.An I/O error occurred while performing the operation. specifies a value outside the range of dates, times, or both permitted for this operation.The caller does not have the required permission. is in an invalid format.
Sets the date and time, in coordinated universal time (UTC), that the file was created.The file for which to set the creation date and time information.A containing the value to set for the creation date and time of . This value is expressed in UTC time.The specified path was not found. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.An I/O error occurred while performing the operation. specifies a value outside the range of dates, times, or both permitted for this operation.The caller does not have the required permission. is in an invalid format.
Sets the date and time the specified file was last accessed.The file for which to set the access date and time information.A containing the value to set for the last access date and time of . This value is expressed in local time. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path was not found.The caller does not have the required permission. is in an invalid format. specifies a value outside the range of dates or times permitted for this operation.
Sets the date and time, in coordinated universal time (UTC), that the specified file was last accessed.The file for which to set the access date and time information.A containing the value to set for the last access date and time of . This value is expressed in UTC time. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path was not found.The caller does not have the required permission. is in an invalid format. specifies a value outside the range of dates or times permitted for this operation.
Sets the date and time that the specified file was last written to.The file for which to set the date and time information.A containing the value to set for the last write date and time of . This value is expressed in local time. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path was not found.The caller does not have the required permission. is in an invalid format. specifies a value outside the range of dates or times permitted for this operation.
Sets the date and time, in coordinated universal time (UTC), that the specified file was last written to.The file for which to set the date and time information.A containing the value to set for the last write date and time of . This value is expressed in UTC time. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path was not found.The caller does not have the required permission. is in an invalid format. specifies a value outside the range of dates or times permitted for this operation.
Creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.The file to write to.The bytes to write to the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is or the byte array is empty.The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
specified a file that is hidden.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission. is in an invalid format.The caller does not have the required permission.
Creates a new file, writes a collection of strings to the file, and then closes the file.The file to write to.The lines to write to the file. is a zero-length string, contains only white space, or contains one or more invalid characters defined by the method.Either or is . is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. exceeds the system-defined maximum length. is in an invalid format.The caller does not have the required permission. specified a file that is read-only.
-or-
specified a file that is hidden.
-or-
This operation is not supported on the current platform.
-or-
is a directory.
-or-
The caller does not have the required permission.
Creates a new file by using the specified encoding, writes a collection of strings to the file, and then closes the file.The file to write to.The lines to write to the file.The character encoding to use. is a zero-length string, contains only white space, or contains one or more invalid characters defined by the method.Either , , or is . is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. exceeds the system-defined maximum length. is in an invalid format.The caller does not have the required permission. specified a file that is read-only.
-or-
specified a file that is hidden.
-or-
This operation is not supported on the current platform.
-or-
is a directory.
-or-
The caller does not have the required permission.
Creates a new file, write the specified string array to the file, and then closes the file.The file to write to.The string array to write to the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .Either or is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
specified a file that is hidden.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission. is in an invalid format.The caller does not have the required permission.
Creates a new file, writes the specified string array to the file by using the specified encoding, and then closes the file.The file to write to.The string array to write to the file.An object that represents the character encoding applied to the string array. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .Either or is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
specified a file that is hidden.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission. is in an invalid format.The caller does not have the required permission.
Creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.The file to write to.The string to write to the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
specified a file that is hidden.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission. is in an invalid format.The caller does not have the required permission.
Creates a new file, writes the specified string to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.The file to write to.The string to write to the file.The encoding to apply to the string. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
specified a file that is hidden.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission. is in an invalid format.The caller does not have the required permission.
ACL (access control list) extension methods for .
Returns the security information of a file.The file from which to obtain the security information.The security descriptors of all the access control sections of the file.
Returns the security information of a file.An existing file from which to obtain the security information.The desired access control sections to retrieve from the file.The security descriptors of the specified access control sections of the file.
Changes the security attributes of an existing file.An existing file.The security information to apply to the file. is .
Provides properties and instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of objects. This class cannot be inherited.
Creates a that appends text to the file represented by this instance of the .A new .
Copies an existing file to a new file, disallowing the overwriting of an existing file.The name of the new file to copy to.A new file with a fully qualified path. is empty, contains only white spaces, or contains invalid characters.An error occurs, or the destination file already exists.The caller does not have the required permission. is .A directory path is passed in, or the file is being moved to a different drive.The directory specified in does not exist.The specified path, file name, or both exceed the system-defined maximum length. contains a colon (:) within the string but does not specify the volume.
Copies an existing file to a new file, allowing the overwriting of an existing file.The name of the new file to copy to. to allow an existing file to be overwritten; otherwise, .A new file, or an overwrite of an existing file if is . If the file exists and is , an is thrown. is empty, contains only white spaces, or contains invalid characters.An error occurs, or the destination file already exists and is .The caller does not have the required permission. is .The directory specified in does not exist.A directory path is passed in, or the file is being moved to a different drive.The specified path, file name, or both exceed the system-defined maximum length. contains a colon (:) in the middle of the string.
Creates a file.A new file.
Creates a that writes a new text file.A new .The file name is a directory.The disk is read-only.The caller does not have the required permission.
Decrypts a file that was encrypted by the current account using the method.An invalid drive was specified.The file described by the current object could not be found.An I/O error occurred while opening the file.The file system is not NTFS.The current operating system is not Microsoft Windows NT or later.The file described by the current object is read-only.
-or-
This operation is not supported on the current platform.
-or-
The caller does not have the required permission.
Encrypts a file so that only the account used to encrypt the file can decrypt it.An invalid drive was specified.The file described by the current object could not be found.An I/O error occurred while opening the file.The file system is not NTFS.The current operating system is not Microsoft Windows NT or later.The file described by the current object is read-only.
-or-
This operation is not supported on the current platform.
-or-
The caller does not have the required permission.
Moves a specified file to a new location, providing the option to specify a new file name.The path to move the file to, which can specify a different file name.An I/O error occurs, such as the destination file already exists or the destination device is not ready. is . is empty, contains only white spaces, or contains invalid characters.The caller does not have the required permission. is read-only or is a directory.The file is not found.The specified path is invalid, such as being on an unmapped drive.The specified path, file name, or both exceed the system-defined maximum length. contains a colon (:) in the middle of the string.
Opens a file in the specified mode.A constant specifying the mode (for example, or ) in which to open the file.A file opened in the specified mode, with read/write access and unshared.The file is not found.The file is read-only or is a directory.The specified path is invalid, such as being on an unmapped drive.The file is already open.
Opens a file in the specified mode with read, write, or read/write access.A constant specifying the mode (for example, or ) in which to open the file.A constant specifying whether to open the file with , , or file access.A object opened in the specified mode and access, and unshared.The caller does not have the required permission.The file is not found. is read-only or is a directory.The specified path is invalid, such as being on an unmapped drive.The file is already open. is empty or contains only white spaces.One or more arguments is null.
Opens a file in the specified mode with read, write, or read/write access and the specified sharing option.A constant specifying the mode (for example, or ) in which to open the file.A constant specifying whether to open the file with , , or file access.A constant specifying the type of access other objects have to this file.A object opened with the specified mode, access, and sharing options.The caller does not have the required permission.The file is not found. is read-only or is a directory.The specified path is invalid, such as being on an unmapped drive.The file is already open. is empty or contains only white spaces.One or more arguments is null.
Creates a read-only .A new read-only object. is read-only or is a directory.The specified path is invalid, such as being on an unmapped drive.The file is already open.
Creates a with UTF8 encoding that reads from an existing text file.A new with UTF8 encoding.The caller does not have the required permission.The file is not found. is read-only or is a directory.The specified path is invalid, such as being on an unmapped drive.
Creates a write-only .A write-only unshared object for a new or existing file.The path specified when creating an instance of the object is read-only or is a directory.The path specified when creating an instance of the object is invalid, such as being on an unmapped drive.
Replaces the contents of a specified file with the file described by the current object, deleting the original file, and creating a backup of the replaced file.The name of a file to replace with the current file.The name of a file with which to create a backup of the file described by the parameter.A object that encapsulates information about the file described by the parameter.The path described by the parameter was not of a legal form.
-or-
The path described by the parameter was not of a legal form.The parameter is .The file described by the current object could not be found.
-or-
The file described by the parameter could not be found.The current operating system is not Microsoft Windows NT or later.
Replaces the contents of a specified file with the file described by the current object, deleting the original file, and creating a backup of the replaced file. Also specifies whether to ignore merge errors.The name of a file to replace with the current file.The name of a file with which to create a backup of the file described by the parameter. to ignore merge errors (such as attributes and ACLs) from the replaced file to the replacement file; otherwise .A object that encapsulates information about the file described by the parameter.The path described by the parameter was not of a legal form.
-or-
The path described by the parameter was not of a legal form.The parameter is .The file described by the current object could not be found.
-or-
The file described by the parameter could not be found.The current operating system is not Microsoft Windows NT or later.
Gets an instance of the parent directory.A object representing the parent directory of this file.The specified path is invalid, such as being on an unmapped drive.The caller does not have the required permission.
Gets a string representing the directory's full path.A string representing the directory's full path. was passed in for the directory name.The fully qualified path name exceeds the system-defined maximum length.The caller does not have the required permission.
Gets or sets a value that determines if the current file is read only. if the current file is read only; otherwise, .The file described by the current object could not be found.An I/O error occurred while opening the file.This operation is not supported on the current platform.
-or-
The caller does not have the required permission.The user does not have write permission, but attempted to set this property to .
Gets the size, in bytes, of the current file.The size of the current file in bytes. cannot update the state of the file or directory.The file does not exist.
-or-
The property is called for a directory.
Provides properties and instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of objects. This class cannot be inherited.
Deletes a file or directory.The specified path is invalid; for example, it is on an unmapped drive.There is an open handle on the file or directory, and the operating system is Windows XP or earlier. This open handle can result from enumerating directories and files. For more information, see How to: Enumerate Directories and Files.
Refreshes the state of the object.A device such as a disk drive is not ready.
Gets or sets the attributes for the current file or directory. of the current .The specified file doesn't exist. Only thrown when setting the property value.The specified path is invalid. For example, it's on an unmapped drive. Only thrown when setting the property value.The caller doesn't have the required permission.The caller attempts to set an invalid file attribute.
-or-
The user attempts to set an attribute value but doesn't have write permission. cannot initialize the data.
Gets or sets the creation time of the current file or directory.The creation date and time of the current object. cannot initialize the data.The specified path is invalid; for example, it is on an unmapped drive.The current operating system is not Windows NT or later.The caller attempts to set an invalid creation time.
Gets or sets the creation time, in coordinated universal time (UTC), of the current file or directory.The creation date and time in UTC format of the current object. cannot initialize the data.The specified path is invalid; for example, it is on an unmapped drive.The current operating system is not Windows NT or later.The caller attempts to set an invalid access time.
Gets a value indicating whether the file or directory exists. if the file or directory exists; otherwise, .
Gets the string representing the extension part of the file.A string containing the extension.
Gets the full path of the directory or file.A string containing the full path.The fully qualified path and file name exceed the system-defined maximum length.The caller does not have the required permission.
Gets or sets the time the current file or directory was last accessed.The time that the current file or directory was last accessed. cannot initialize the data.The current operating system is not Windows NT or later.The caller attempts to set an invalid access time
Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was last accessed.The UTC time that the current file or directory was last accessed. cannot initialize the data.The current operating system is not Windows NT or later.The caller attempts to set an invalid access time.
Gets or sets the time when the current file or directory was last written to.The time the current file was last written. cannot initialize the data.The current operating system is not Windows NT or later.The caller attempts to set an invalid write time.
Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.The UTC time when the current file was last written to. cannot initialize the data.The current operating system is not Windows NT or later.The caller attempts to set an invalid write time.
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 property gets the name of the directory.A string that is the name of the parent directory, the name of the last directory in the hierarchy, or the name of a file, including the file name extension.
Creates a that appends text to the file represented by this instance of the .A new .
Copies an existing file to a new file, disallowing the overwriting of an existing file.The name of the new file to copy to.A new file with a fully qualified path. is empty, contains only white spaces, or contains invalid characters.An error occurs, or the destination file already exists.The caller does not have the required permission. is .A directory path is passed in, or the file is being moved to a different drive.The directory specified in does not exist.The specified path, file name, or both exceed the system-defined maximum length. contains a colon (:) within the string but does not specify the volume.
Copies an existing file to a new file, allowing the overwriting of an existing file.The name of the new file to copy to. to allow an existing file to be overwritten; otherwise, .A new file, or an overwrite of an existing file if is . If the file exists and is , an is thrown. is empty, contains only white spaces, or contains invalid characters.An error occurs, or the destination file already exists and is .The caller does not have the required permission. is .The directory specified in does not exist.A directory path is passed in, or the file is being moved to a different drive.The specified path, file name, or both exceed the system-defined maximum length. contains a colon (:) in the middle of the string.
Creates a file.A new file.
Creates a that writes a new text file.A new .The file name is a directory.The disk is read-only.The caller does not have the required permission.
Decrypts a file that was encrypted by the current account using the method.An invalid drive was specified.The file described by the current object could not be found.An I/O error occurred while opening the file.The file system is not NTFS.The current operating system is not Microsoft Windows NT or later.The file described by the current object is read-only.
-or-
This operation is not supported on the current platform.
-or-
The caller does not have the required permission.
Encrypts a file so that only the account used to encrypt the file can decrypt it.An invalid drive was specified.The file described by the current object could not be found.An I/O error occurred while opening the file.The file system is not NTFS.The current operating system is not Microsoft Windows NT or later.The file described by the current object is read-only.
-or-
This operation is not supported on the current platform.
-or-
The caller does not have the required permission.
Moves a specified file to a new location, providing the option to specify a new file name.The path to move the file to, which can specify a different file name.An I/O error occurs, such as the destination file already exists or the destination device is not ready. is . is empty, contains only white spaces, or contains invalid characters.The caller does not have the required permission. is read-only or is a directory.The file is not found.The specified path is invalid, such as being on an unmapped drive.The specified path, file name, or both exceed the system-defined maximum length. contains a colon (:) in the middle of the string.
Opens a file in the specified mode.A constant specifying the mode (for example, or ) in which to open the file.A file opened in the specified mode, with read/write access and unshared.The file is not found.The file is read-only or is a directory.The specified path is invalid, such as being on an unmapped drive.The file is already open.
Opens a file in the specified mode with read, write, or read/write access.A constant specifying the mode (for example, or ) in which to open the file.A constant specifying whether to open the file with , , or file access.A object opened in the specified mode and access, and unshared.The caller does not have the required permission.The file is not found. is read-only or is a directory.The specified path is invalid, such as being on an unmapped drive.The file is already open. is empty or contains only white spaces.One or more arguments is null.
Opens a file in the specified mode with read, write, or read/write access and the specified sharing option.A constant specifying the mode (for example, or ) in which to open the file.A constant specifying whether to open the file with , , or file access.A constant specifying the type of access other objects have to this file.A object opened with the specified mode, access, and sharing options.The caller does not have the required permission.The file is not found. is read-only or is a directory.The specified path is invalid, such as being on an unmapped drive.The file is already open. is empty or contains only white spaces.One or more arguments is null.
Creates a read-only .A new read-only object. is read-only or is a directory.The specified path is invalid, such as being on an unmapped drive.The file is already open.
Creates a with UTF8 encoding that reads from an existing text file.A new with UTF8 encoding.The caller does not have the required permission.The file is not found. is read-only or is a directory.The specified path is invalid, such as being on an unmapped drive.
Creates a write-only .A write-only unshared object for a new or existing file.The path specified when creating an instance of the object is read-only or is a directory.The path specified when creating an instance of the object is invalid, such as being on an unmapped drive.
Replaces the contents of a specified file with the file described by the current object, deleting the original file, and creating a backup of the replaced file.The name of a file to replace with the current file.The name of a file with which to create a backup of the file described by the parameter.A object that encapsulates information about the file described by the parameter.The path described by the parameter was not of a legal form.
-or-
The path described by the parameter was not of a legal form.The parameter is .The file described by the current object could not be found.
-or-
The file described by the parameter could not be found.The current operating system is not Microsoft Windows NT or later.
Replaces the contents of a specified file with the file described by the current object, deleting the original file, and creating a backup of the replaced file. Also specifies whether to ignore merge errors.The name of a file to replace with the current file.The name of a file with which to create a backup of the file described by the parameter. to ignore merge errors (such as attributes and ACLs) from the replaced file to the replacement file; otherwise .A object that encapsulates information about the file described by the parameter.The path described by the parameter was not of a legal form.
-or-
The path described by the parameter was not of a legal form.The parameter is .The file described by the current object could not be found.
-or-
The file described by the parameter could not be found.The current operating system is not Microsoft Windows NT or later.
Gets an instance of the parent directory.A object representing the parent directory of this file.The specified path is invalid, such as being on an unmapped drive.The caller does not have the required permission.
Gets a string representing the directory's full path.A string representing the directory's full path. was passed in for the directory name.The fully qualified path name exceeds the system-defined maximum length.The caller does not have the required permission.
Gets or sets a value that determines if the current file is read only. if the current file is read only; otherwise, .The file described by the current object could not be found.An I/O error occurred while opening the file.This operation is not supported on the current platform.
-or-
The caller does not have the required permission.The user does not have write permission, but attempted to set this property to .
Gets the size, in bytes, of the current file.The size of the current file in bytes. cannot update the state of the file or directory.The file does not exist.
-or-
The property is called for a directory.
Returns a string that represents the current object.A string that represents the current object.
Gets a access control object that encapsulates the access control list (ACL) entries for the file or directory in the file system.
Gets a access control object that encapsulates the access control list (ACL) entries for the file or directory in the file system.
One of the values that specifies the type of access control list (ACL) information to receive.
Applies access control list (ACL) entries described by the object to the file or directory in the file system.
ACL (access control list) extension methods for .
Returns the security information of a file.An existing file from which to obtain the security information. is .The file stream is closed.The security descriptors of all the access control sections of the file.
Changes the security attributes of an existing file.An existing file.The security information to apply to the file. or is .The file stream is closed.
Abstraction of the file system.
Abstraction of the file system.
Abstraction for static methods in .
Abstraction for static methods in .
A factory for the creation of wrappers for .
A factory for the creation of wrappers for .
Abstraction for static methods and properties in .
A factory for the creation of wrappers for .
A factory for the creation of wrappers for .
A factory for the creation of wrappers for .
Abstraction of the file system.
Abstraction for static methods in .
Abstraction for static methods in .
A factory for the creation of wrappers for .
A factory for the creation of wrappers for .
Abstraction for static methods and properties in .
A factory for the creation of wrappers for .
A factory for the creation of wrappers for .
A factory for the creation of wrappers for .
Provides the base class for both and objects.
Exposes the underlying filesystem implementation. This is useful for implementing extension methods.
Deletes a file or directory.The specified path is invalid; for example, it is on an unmapped drive.There is an open handle on the file or directory, and the operating system is Windows XP or earlier. This open handle can result from enumerating directories and files. For more information, see How to: Enumerate Directories and Files.
Refreshes the state of the object.A device such as a disk drive is not ready.
Gets or sets the attributes for the current file or directory. of the current .The specified file doesn't exist. Only thrown when setting the property value.The specified path is invalid. For example, it's on an unmapped drive. Only thrown when setting the property value.The caller doesn't have the required permission.The caller attempts to set an invalid file attribute.
-or-
The user attempts to set an attribute value but doesn't have write permission. cannot initialize the data.
Gets or sets the creation time of the current file or directory.The creation date and time of the current object. cannot initialize the data.The specified path is invalid; for example, it is on an unmapped drive.The current operating system is not Windows NT or later.The caller attempts to set an invalid creation time.
Gets or sets the creation time, in coordinated universal time (UTC), of the current file or directory.The creation date and time in UTC format of the current object. cannot initialize the data.The specified path is invalid; for example, it is on an unmapped drive.The current operating system is not Windows NT or later.The caller attempts to set an invalid access time.
Gets a value indicating whether the file or directory exists. if the file or directory exists; otherwise, .
Gets the string representing the extension part of the file.A string containing the extension.
Gets the full path of the directory or file.A string containing the full path.The fully qualified path and file name exceed the system-defined maximum length.The caller does not have the required permission.
Gets or sets the time the current file or directory was last accessed.The time that the current file or directory was last accessed. cannot initialize the data.The current operating system is not Windows NT or later.The caller attempts to set an invalid access time
Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was last accessed.The UTC time that the current file or directory was last accessed. cannot initialize the data.The current operating system is not Windows NT or later.The caller attempts to set an invalid access time.
Gets or sets the time when the current file or directory was last written to.The time the current file was last written. cannot initialize the data.The current operating system is not Windows NT or later.The caller attempts to set an invalid write time.
Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.The UTC time when the current file was last written to. cannot initialize the data.The current operating system is not Windows NT or later.The caller attempts to set an invalid write time.
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 property gets the name of the directory.A string that is the name of the parent directory, the name of the last directory in the hierarchy, or the name of a file, including the file name extension.
Listens to the file system change notifications and raises events when a directory, or file in a directory, changes.
Exposes the underlying file system implementation.
This is useful for implementing extension methods.
Gets or sets a value indicating whether subdirectories within the specified path should be monitored. if you want to monitor subdirectories; otherwise, . The default is .
Encapsulates zero or more components.
Gets or sets a value indicating whether the component is enabled. if the component is enabled; otherwise, . The default is . If you are using the component on a designer in Visual Studio 2005, the default is .The object has been disposed.The current operating system is not Microsoft Windows NT or later.The directory specified in could not be found. has not been set or is invalid.
Gets or sets the filter string used to determine what files are monitored in a directory.The filter string. The default is "*.*" (Watches all files.)
Gets or sets the size (in bytes) of the internal buffer.The internal buffer size in bytes. The default is 8192 (8 KB).
Gets or sets the type of changes to watch for.One of the values. The default is the bitwise OR combination of , , and .The value is not a valid bitwise OR combination of the values.The value that is being set is not valid.
Gets or sets the path of the directory to watch.The path to monitor. The default is an empty string ("").The specified path does not exist or could not be found.
-or-
The specified path contains wildcard characters.
-or-
The specified path contains invalid path characters.
Gets or sets an for the .An for the .
Gets or sets the object used to marshal the event handler calls issued as a result of a directory change.The that represents the object used to marshal the event handler calls issued as a result of a directory change. The default is .
Occurs when a file or directory in the specified is changed.
Occurs when a file or directory in the specified is created.
Occurs when a file or directory in the specified is deleted.
Occurs when the instance of is unable to continue monitoring changes or when the internal buffer overflows.
Occurs when a file or directory in the specified is renamed.
Begins the initialization of a used on a form or used by another component. The initialization occurs at run time.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Ends the initialization of a used on a form or used by another component. The initialization occurs at run time.
A synchronous method that returns a structure that contains specific information on the change that occurred, given the type of change you want to monitor.The to watch for.A that contains specific information on the change that occurred.
A synchronous method that returns a structure that contains specific information on the change that occurred, given the type of change you want to monitor and the time (in milliseconds) to wait before timing out.The to watch for.The time (in milliseconds) to wait before timing out.A that contains specific information on the change that occurred.
A factory for the creation of wrappers for in a .
Exposes the underlying file system implementation.
This is useful for implementing extension methods.
Initializes a new instance of a wrapper for which implements .
Initializes a new instance of a wrapper for which implements .
The directory to monitor, in standard or Universal Naming Convention (UNC) notation.
Initializes a new instance of a wrapper for which implements .
The directory to monitor, in standard or Universal Naming Convention (UNC) notation.The type of files to watch. For example, "*.txt" watches for changes to all text files.
Initializes a new instance of a wrapper for which implements .
Initializes a new instance of a wrapper for which implements .
The directory to monitor, in standard or Universal Naming Convention (UNC) notation.
Initializes a new instance of a wrapper for which implements .
The directory to monitor, in standard or Universal Naming Convention (UNC) notation.
The type of files to watch.
For example, "*.txt" watches for changes to all text files.
Wraps the to the testable interface .
Listens to the file system change notifications and raises events when a directory, or file in a directory, changes.
Listens to the file system change notifications and raises events when a directory, or file in a directory, changes.
Listens to the file system change notifications and raises events when a directory, or file in a directory, changes.
Listens to the file system change notifications and raises events when a directory, or file in a directory, changes.
Listens to the file system change notifications and raises events when a directory, or file in a directory, changes.
Exposes the underlying file system implementation.
This is useful for implementing extension methods.
Gets or sets a value indicating whether subdirectories within the specified path should be monitored. if you want to monitor subdirectories; otherwise, . The default is .
Encapsulates zero or more components.
Gets or sets a value indicating whether the component is enabled. if the component is enabled; otherwise, . The default is . If you are using the component on a designer in Visual Studio 2005, the default is .The object has been disposed.The current operating system is not Microsoft Windows NT or later.The directory specified in could not be found. has not been set or is invalid.
Gets or sets the filter string used to determine what files are monitored in a directory.The filter string. The default is "*.*" (Watches all files.)
Gets or sets the size (in bytes) of the internal buffer.The internal buffer size in bytes. The default is 8192 (8 KB).
Gets or sets the type of changes to watch for.One of the values. The default is the bitwise OR combination of , , and .The value is not a valid bitwise OR combination of the values.The value that is being set is not valid.
Gets or sets the path of the directory to watch.The path to monitor. The default is an empty string ("").The specified path does not exist or could not be found.
-or-
The specified path contains wildcard characters.
-or-
The specified path contains invalid path characters.
Gets or sets an for the .An for the .
Gets or sets the object used to marshal the event handler calls issued as a result of a directory change.The that represents the object used to marshal the event handler calls issued as a result of a directory change. The default is .
Begins the initialization of a used on a form or used by another component. The initialization occurs at run time.
Ends the initialization of a used on a form or used by another component. The initialization occurs at run time.
A synchronous method that returns a structure that contains specific information on the change that occurred, given the type of change you want to monitor.The to watch for.A that contains specific information on the change that occurred.
A synchronous method that returns a structure that contains specific information on the change that occurred, given the type of change you want to monitor and the time (in milliseconds) to wait before timing out.The to watch for.The time (in milliseconds) to wait before timing out.A that contains specific information on the change that occurred.
Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of objects.
Asynchronously appends lines to a file, and then closes the file. If the specified file does not exist, this method creates a file, writes the specified lines to the file, and then closes the file.The file to append the lines to. The file is created if it doesn't already exist.The lines to append to the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous append operation.
Asynchronously appends lines to a file by using a specified encoding, and then closes the file. If the specified file does not exist, this method creates a file, writes the specified lines to the file, and then closes the file.The file to append the lines to. The file is created if it doesn't already exist.The lines to append to the file.The character encoding to use.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous append operation.
Asynchronously opens a file or creates a file if it does not already exist, appends the specified string to the file, and then closes the file.The file to append the specified string to.The string to append to the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous append operation.
Asynchronously opens a file or creates the file if it does not already exist, appends the specified string to the file using the specified encoding, and then closes the file.The file to append the specified string to.The string to append to the file.The character encoding to use.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous append operation.
Asynchronously opens a binary file, reads the contents of the file into a byte array, and then closes the file.The file to open for reading.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous read operation, which wraps the byte array containing the contents of the file.
Asynchronously opens a text file, reads all lines of the file, and then closes the file.The file to open for reading.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous read operation, which wraps the string array containing all lines of the file.
Asynchronously opens a text file, reads all lines of the file with the specified encoding, and then closes the file.The file to open for reading.The encoding applied to the contents of the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous read operation, which wraps the string array containing all lines of the file.
Asynchronously opens a text file, reads all the text in the file, and then closes the file.The file to open for reading.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous read operation, which wraps the string containing all text in the file.
Asynchronously opens a text file, reads all text in the file with the specified encoding, and then closes the file.The file to open for reading.The encoding applied to the contents of the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous read operation, which wraps the string containing all text in the file.
Asynchronously creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.The file to write to.The bytes to write to the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous write operation.
Asynchronously creates a new file, writes the specified lines to the file, and then closes the file.The file to write to.The lines to write to the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous write operation.
Asynchronously creates a new file, write the specified lines to the file by using the specified encoding, and then closes the file.The file to write to.The lines to write to the file.The character encoding to use.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous write operation.
Asynchronously creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.The file to write to.The string to write to the file.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous write operation.
Asynchronously creates a new file, writes the specified string to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.The file to write to.The string to write to the file.The encoding to apply to the string.The token to monitor for cancellation requests. The default value is .A task that represents the asynchronous write operation.
Appends lines to a file, and then closes the file. If the specified file does not exist, this method creates a file, writes the specified lines to the file, and then closes the file.The file to append the lines to. The file is created if it doesn't already exist.The lines to append to the file. is a zero-length string, contains only white space, or contains one more invalid characters defined by the method.Either or is . is invalid (for example, the directory doesn't exist or it is on an unmapped drive).The file specified by was not found.An I/O error occurred while opening the file. exceeds the system-defined maximum length. is in an invalid format.The caller does not have permission to write to the file. specifies a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
is a directory.
Appends lines to a file by using a specified encoding, and then closes the file. If the specified file does not exist, this method creates a file, writes the specified lines to the file, and then closes the file.The file to append the lines to. The file is created if it doesn't already exist.The lines to append to the file.The character encoding to use. is a zero-length string, contains only white space, or contains one more invalid characters defined by the method.Either , , or is . is invalid (for example, the directory doesn't exist or it is on an unmapped drive).The file specified by was not found.An I/O error occurred while opening the file. exceeds the system-defined maximum length. is in an invalid format.The caller does not have the required permission. specifies a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
is a directory.
-or-
The caller does not have the required permission.
Opens a file, appends the specified string to the file, and then closes the file. If the file does not exist, this method creates a file, writes the specified string to the file, then closes the file.The file to append the specified string to.The string to append to the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, the directory doesn't exist or it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission. is in an invalid format.The caller does not have the required permission.
Appends the specified string to the file using the specified encoding, creating the file if it does not already exist.The file to append the specified string to.The string to append to the file.The character encoding to use. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, the directory doesn't exist or it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission. is in an invalid format.The caller does not have the required permission.
Creates a that appends UTF-8 encoded text to an existing file, or to a new file if the specified file does not exist.The path to the file to append to.A stream writer that appends UTF-8 encoded text to the specified file or to a new file.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, the directory doesn't exist or it is on an unmapped drive). is in an invalid format.
Copies an existing file to a new file. Overwriting a file of the same name is not allowed.The file to copy.The name of the destination file. This cannot be a directory or an existing file.The caller does not have the required permission. or is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
-or-
or specifies a directory. or is .The specified path, file name, or both exceed the system-defined maximum length.The path specified in or is invalid (for example, it is on an unmapped drive). was not found. exists.
-or-
An I/O error has occurred. or is in an invalid format.
Copies an existing file to a new file. Overwriting a file of the same name is allowed.The file to copy.The name of the destination file. This cannot be a directory. if the destination file can be overwritten; otherwise, .The caller does not have the required permission.
-or-
is read-only.
-or-
is , exists and is hidden, but is not hidden. or is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
-or-
or specifies a directory. or is .The specified path, file name, or both exceed the system-defined maximum length.The path specified in or is invalid (for example, it is on an unmapped drive). was not found. exists and is .
-or-
An I/O error has occurred. or is in an invalid format.
Creates or overwrites a file in the specified path.The path and name of the file to create.A that provides read/write access to the file specified in .The caller does not have the required permission.
-or-
specified a file that is read-only.
-or-
specified a file that is hidden. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while creating the file. is in an invalid format.
Creates or overwrites the specified file.The name of the file.The number of bytes buffered for reads and writes to the file.A with the specified buffer size that provides read/write access to the file specified in .The caller does not have the required permission.
-or-
specified a file that is read-only.
-or-
specified a file that is hidden. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while creating the file. is in an invalid format.
Creates or overwrites the specified file, specifying a buffer size and a value that describes how to create or overwrite the file.The name of the file.The number of bytes buffered for reads and writes to the file.One of the values that describes how to create or overwrite the file.A new file with the specified buffer size.The caller does not have the required permission.
-or-
specified a file that is read-only.
-or-
specified a file that is hidden. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive.An I/O error occurred while creating the file. is in an invalid format.
Creates or opens a file for writing UTF-8 encoded text. If the file already exists, its contents are overwritten.The file to be opened for writing.A that writes to the specified file using UTF-8 encoding.The caller does not have the required permission.
-or-
specified a file that is read-only.
-or-
specified a file that is hidden. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive). is in an invalid format.
Decrypts a file that was encrypted by the current account using the method.A path that describes a file to decrypt.The parameter is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .The parameter is .An invalid drive was specified.The file described by the parameter could not be found.An I/O error occurred while opening the file. For example, the encrypted file is already open.
-or-
This operation is not supported on the current platform.The specified path, file name, or both exceed the system-defined maximum length.The current operating system is not Windows NT or later.The file system is not NTFS.The parameter specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
The parameter specified a directory.
-or-
The caller does not have the required permission.
Deletes the specified file.The name of the file to be deleted. Wildcard characters are not supported. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path is invalid (for example, it is on an unmapped drive).The specified file is in use.
-or-
There is an open handle on the file, and the operating system is Windows XP or earlier. This open handle can result from enumerating directories and files. For more information, see How to: Enumerate Directories and Files. is in an invalid format.The specified path, file name, or both exceed the system-defined maximum length.The caller does not have the required permission.
-or-
The file is an executable file that is in use.
-or-
is a directory.
-or-
specified a read-only file.
Encrypts a file so that only the account used to encrypt the file can decrypt it.A path that describes a file to encrypt.The parameter is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .The parameter is .An invalid drive was specified.The file described by the parameter could not be found.An I/O error occurred while opening the file.
-or-
This operation is not supported on the current platform.The specified path, file name, or both exceed the system-defined maximum length.The current operating system is not Windows NT or later.The file system is not NTFS.The parameter specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
The parameter specified a directory.
-or-
The caller does not have the required permission.
Determines whether the specified file exists.The file to check. if the caller has the required permissions and contains the name of an existing file; otherwise, . This method also returns if is , an invalid path, or a zero-length string. If the caller does not have sufficient permissions to read the specified file, no exception is thrown and the method returns regardless of the existence of .
Gets the of the file on the path.The path to the file.The of the file on the path. is empty, contains only white spaces, or contains invalid characters.The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format. represents a file and is invalid, such as being on an unmapped drive, or the file cannot be found. represents a directory and is invalid, such as being on an unmapped drive, or the directory cannot be found.This file is being used by another process.The caller does not have the required permission.
Returns the creation date and time of the specified file or directory.The file or directory for which to obtain creation date and time information.A structure set to the creation date and time for the specified file or directory. This value is expressed in local time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.
Returns the creation date and time, in coordinated universal time (UTC), of the specified file or directory.The file or directory for which to obtain creation date and time information.A structure set to the creation date and time for the specified file or directory. This value is expressed in UTC time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.
Returns the date and time the specified file or directory was last accessed.The file or directory for which to obtain access date and time information.A structure set to the date and time that the specified file or directory was last accessed. This value is expressed in local time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.
Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last accessed.The file or directory for which to obtain access date and time information.A structure set to the date and time that the specified file or directory was last accessed. This value is expressed in UTC time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.
Returns the date and time the specified file or directory was last written to.The file or directory for which to obtain write date and time information.A structure set to the date and time that the specified file or directory was last written to. This value is expressed in local time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.
Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last written to.The file or directory for which to obtain write date and time information.A structure set to the date and time that the specified file or directory was last written to. This value is expressed in UTC time.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.
Moves a specified file to a new location, providing the option to specify a new file name.The name of the file to move. Can include a relative or absolute path.The new path and name for the file.The destination file already exists.
-or-
was not found. or is . or is a zero-length string, contains only white space, or contains invalid characters as defined in .The caller does not have the required permission.The specified path, file name, or both exceed the system-defined maximum length.The path specified in or is invalid, (for example, it is on an unmapped drive). or is in an invalid format.
Opens a on the specified path with read/write access with no sharing.The file to open.A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.A opened in the specified mode and path, with read/write access and not shared. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid, (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.
-or-
is and the specified file is a hidden file. specified an invalid value.The file specified in was not found. is in an invalid format.
Opens a on the specified path, with the specified mode and access with no sharing.The file to open.A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.A value that specifies the operations that can be performed on the file.An unshared that provides access to the specified file, with the specified mode and access. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
-or-
specified and specified , , , or . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid, (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only and is not .
-or-
specified a directory.
-or-
The caller does not have the required permission.
-or-
is and the specified file is a hidden file. or specified an invalid value.The file specified in was not found. is in an invalid format.
Opens a on the specified path, having the specified mode with read, write, or read/write access and the specified sharing option.The file to open.A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.A value that specifies the operations that can be performed on the file.A value specifying the type of access other threads have to the file.A on the specified path, having the specified mode with read, write, or read/write access and the specified sharing option. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
-or-
specified and specified , , , or . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid, (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only and is not .
-or-
specified a directory.
-or-
The caller does not have the required permission.
-or-
is and the specified file is a hidden file., , or specified an invalid value.The file specified in was not found. is in an invalid format.
Opens an existing file for reading.The file to be opened for reading.A read-only on the specified path. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid, (for example, it is on an unmapped drive). specified a directory.
-or-
The caller does not have the required permission.The file specified in was not found. is in an invalid format.An I/O error occurred while opening the file.
Opens an existing UTF-8 encoded text file for reading.The file to be opened for reading.A on the specified path.The caller does not have the required permission. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid, (for example, it is on an unmapped drive).The file specified in was not found. is in an invalid format.
Opens an existing file or creates a new file for writing.The file to be opened for writing.An unshared object on the specified path with access.The caller does not have the required permission.
-or-
specified a read-only file or directory. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid, (for example, it is on an unmapped drive). is in an invalid format.
Opens a binary file, reads the contents of the file into a byte array, and then closes the file.The file to open for reading.A byte array containing the contents of the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file.This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.The file specified in was not found. is in an invalid format.The caller does not have the required permission.
Opens a text file, reads all lines of the file, and then closes the file.The file to open for reading.A string array containing all lines of the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.The file specified in was not found. is in an invalid format.The caller does not have the required permission.
Opens a file, reads all lines of the file with the specified encoding, and then closes the file.The file to open for reading.The encoding applied to the contents of the file.A string array containing all lines of the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.The file specified in was not found. is in an invalid format.The caller does not have the required permission.
Opens a text file, reads all the text in the file, and then closes the file.The file to open for reading.A string containing all the text in the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.The file specified in was not found. is in an invalid format.The caller does not have the required permission.
Opens a file, reads all text in the file with the specified encoding, and then closes the file.The file to open for reading.The encoding applied to the contents of the file.A string containing all text in the file. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path is invalid (for example, it is on an unmapped drive).An I/O error occurred while opening the file. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.The file specified in was not found. is in an invalid format.The caller does not have the required permission.
Reads the lines of a file.The file to read.All the lines of the file, or the lines that are the result of a query. is a zero-length string, contains only white space, or contains one or more invalid characters defined by the method. is . is invalid (for example, it is on an unmapped drive).The file specified by was not found.An I/O error occurred while opening the file. exceeds the system-defined maximum length.The caller does not have the required permission. specifies a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
is a directory.
-or-
The caller does not have the required permission.
Read the lines of a file that has a specified encoding.The file to read.The encoding that is applied to the contents of the file.All the lines of the file, or the lines that are the result of a query. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by the method. is . is invalid (for example, it is on an unmapped drive).The file specified by was not found.An I/O error occurred while opening the file. exceeds the system-defined maximum length.The caller does not have the required permission. specifies a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
is a directory.
-or-
The caller does not have the required permission.
Replaces the contents of a specified file with the contents of another file, deleting the original file, and creating a backup of the replaced file.The name of a file that replaces the file specified by .The name of the file being replaced.The name of the backup file.The path described by the parameter was not of a legal form.
-or-
The path described by the parameter was not of a legal form.The parameter is .An invalid drive was specified.The file described by the current object could not be found.
-or-
The file described by the parameter could not be found.An I/O error occurred while opening the file.
-or-
The and parameters specify the same file.The specified path, file name, or both exceed the system-defined maximum length.The operating system is Windows 98 Second Edition or earlier and the files system is not NTFS.The or parameter specifies a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
Source or destination parameters specify a directory instead of a file.
-or-
The caller does not have the required permission.
Replaces the contents of a specified file with the contents of another file, deleting the original file, and creating a backup of the replaced file and optionally ignores merge errors.The name of a file that replaces the file specified by .The name of the file being replaced.The name of the backup file. to ignore merge errors (such as attributes and access control lists (ACLs)) from the replaced file to the replacement file; otherwise, .The path described by the parameter was not of a legal form.
-or-
The path described by the parameter was not of a legal form.The parameter is .An invalid drive was specified.The file described by the current object could not be found.
-or-
The file described by the parameter could not be found.An I/O error occurred while opening the file.
-or-
The and parameters specify the same file.The specified path, file name, or both exceed the system-defined maximum length.The operating system is Windows 98 Second Edition or earlier and the files system is not NTFS.The or parameter specifies a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
Source or destination parameters specify a directory instead of a file.
-or-
The caller does not have the required permission.
Sets the specified of the file on the specified path.The path to the file.A bitwise combination of the enumeration values. is empty, contains only white spaces, contains invalid characters, or the file attribute is invalid.The specified path, file name, or both exceed the system-defined maximum length. is in an invalid format.The specified path is invalid, (for example, it is on an unmapped drive).The file cannot be found. specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.
Sets the date and time the file was created.The file for which to set the creation date and time information.A containing the value to set for the creation date and time of . This value is expressed in local time.The specified path was not found. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.An I/O error occurred while performing the operation. specifies a value outside the range of dates, times, or both permitted for this operation.The caller does not have the required permission. is in an invalid format.
Sets the date and time, in coordinated universal time (UTC), that the file was created.The file for which to set the creation date and time information.A containing the value to set for the creation date and time of . This value is expressed in UTC time.The specified path was not found. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.An I/O error occurred while performing the operation. specifies a value outside the range of dates, times, or both permitted for this operation.The caller does not have the required permission. is in an invalid format.
Sets the date and time the specified file was last accessed.The file for which to set the access date and time information.A containing the value to set for the last access date and time of . This value is expressed in local time. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path was not found.The caller does not have the required permission. is in an invalid format. specifies a value outside the range of dates or times permitted for this operation.
Sets the date and time, in coordinated universal time (UTC), that the specified file was last accessed.The file for which to set the access date and time information.A containing the value to set for the last access date and time of . This value is expressed in UTC time. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path was not found.The caller does not have the required permission. is in an invalid format. specifies a value outside the range of dates or times permitted for this operation.
Sets the date and time that the specified file was last written to.The file for which to set the date and time information.A containing the value to set for the last write date and time of . This value is expressed in local time. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path was not found.The caller does not have the required permission. is in an invalid format. specifies a value outside the range of dates or times permitted for this operation.
Sets the date and time, in coordinated universal time (UTC), that the specified file was last written to.The file for which to set the date and time information.A containing the value to set for the last write date and time of . This value is expressed in UTC time. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . is .The specified path, file name, or both exceed the system-defined maximum length.The specified path was not found.The caller does not have the required permission. is in an invalid format. specifies a value outside the range of dates or times permitted for this operation.
Creates a new file, writes the specified byte array to the file, and then closes the file.
If the target file already exists, it is overwritten.
The file to write to.
The bytes to write to the file.
is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
is or contents is empty.
The specified path, file name, or both exceed the system-defined maximum length.
For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
The specified path is invalid (for example, it is on an unmapped drive).
An I/O error occurred while opening the file.
path specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
path specified a directory.
-or-
The caller does not have the required permission.
The file specified in was not found.
is in an invalid format.
The caller does not have the required permission.
Given a byte array and a file path, this method opens the specified file, writes the contents of the byte array to the file, and then closes the file.
Creates a new file, writes a collection of strings to the file, and then closes the file.
The file to write to.
The lines to write to the file.
is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
Either or is .
The specified path is invalid (for example, it is on an unmapped drive).
The file specified in was not found.
An I/O error occurred while opening the file.
The specified path, file name, or both exceed the system-defined maximum length.
For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
is in an invalid format.
The caller does not have the required permission.
specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.
If the target file already exists, it is overwritten.
You can use this method to create the contents for a collection class that takes an in its constructor, such as a , , or a class.
Creates a new file by using the specified encoding, writes a collection of strings to the file, and then closes the file.
The file to write to.
The lines to write to the file.
The character encoding to use.
is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
Either , , or is .
The specified path is invalid (for example, it is on an unmapped drive).
The file specified in was not found.
An I/O error occurred while opening the file.
The specified path, file name, or both exceed the system-defined maximum length.
For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
is in an invalid format.
The caller does not have the required permission.
specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.
If the target file already exists, it is overwritten.
You can use this method to create a file that contains the following:
-
The results of a LINQ to Objects query on the lines of a file, as obtained by using the ReadLines method.
-
The contents of a collection that implements an of strings.
Creates a new file, writes the specified string array to the file by using the specified encoding, and then closes the file.
The file to write to.
The string array to write to the file.
is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
Either or is .
The specified path, file name, or both exceed the system-defined maximum length.
For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
The specified path is invalid (for example, it is on an unmapped drive).
An I/O error occurred while opening the file.
specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.
The file specified in was not found.
is in an invalid format.
The caller does not have the required permission.
If the target file already exists, it is overwritten.
The default behavior of the WriteAllLines method is to write out data using UTF-8 encoding without a byte order mark (BOM). If it is necessary to include a UTF-8 identifier, such as a byte order mark, at the beginning of a file, use the method overload with encoding.
Given a string array and a file path, this method opens the specified file, writes the string array to the file using the specified encoding,
and then closes the file.
Creates a new file, writes the specified string array to the file by using the specified encoding, and then closes the file.
The file to write to.
The string array to write to the file.
An object that represents the character encoding applied to the string array.
is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
Either or is .
The specified path, file name, or both exceed the system-defined maximum length.
For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
The specified path is invalid (for example, it is on an unmapped drive).
An I/O error occurred while opening the file.
specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
specified a directory.
-or-
The caller does not have the required permission.
The file specified in was not found.
is in an invalid format.
The caller does not have the required permission.
If the target file already exists, it is overwritten.
Given a string array and a file path, this method opens the specified file, writes the string array to the file using the specified encoding,
and then closes the file.
Creates a new file, writes the specified string to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.
The file to write to.
The string to write to the file.
is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
is or contents is empty.
The specified path, file name, or both exceed the system-defined maximum length.
For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
The specified path is invalid (for example, it is on an unmapped drive).
An I/O error occurred while opening the file.
path specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
path specified a directory.
-or-
The caller does not have the required permission.
The file specified in was not found.
is in an invalid format.
The caller does not have the required permission.
This method uses UTF-8 encoding without a Byte-Order Mark (BOM), so using the method will return an empty byte array.
If it is necessary to include a UTF-8 identifier, such as a byte order mark, at the beginning of a file, use the method overload with encoding.
Given a string and a file path, this method opens the specified file, writes the string to the file, and then closes the file.
Creates a new file, writes the specified string to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.
The file to write to.
The string to write to the file.
The encoding to apply to the string.
is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
is or contents is empty.
The specified path, file name, or both exceed the system-defined maximum length.
For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
The specified path is invalid (for example, it is on an unmapped drive).
An I/O error occurred while opening the file.
path specified a file that is read-only.
-or-
This operation is not supported on the current platform.
-or-
path specified a directory.
-or-
The caller does not have the required permission.
The file specified in was not found.
is in an invalid format.
The caller does not have the required permission.
Given a string and a file path, this method opens the specified file, writes the string to the file using the specified encoding, and then closes the file.
The file handle is guaranteed to be closed by this method, even if exceptions are raised.
Performs operations on instances that contain file or directory path information. These operations are performed in a cross-platform manner.
Exposes the underlying filesystem implementation. This is useful for implementing extension methods.
Provides a platform-specific alternate character used to separate directory levels in a path string that reflects a hierarchical file system organization.
Provides a platform-specific character used to separate directory levels in a path string that reflects a hierarchical file system organization.
Provides a platform-specific array of characters that cannot be specified in path string arguments passed to members of the class.
A platform-specific separator character used to separate path strings in environment variables.
Provides a platform-specific volume separator character.
Changes the extension of a path string.The path information to modify. The path cannot contain any of the characters defined in .The new extension (with or without a leading period). Specify to remove an existing extension from .The modified path information.
On Windows-based desktop platforms, if is or an empty string (""), the path information is returned unmodified. If is , the returned string contains the specified path with its extension removed. If has no extension, and is not , the returned path string contains appended to the end of . contains one or more of the invalid characters defined in .
Combines an array of strings into a path.An array of parts of the path.The combined paths.One of the strings in the array contains one or more of the invalid characters defined in .One of the strings in the array is .
Combines two strings into a path.The first path to combine.The second path to combine.The combined paths. If one of the specified paths is a zero-length string, this method returns the other path. If contains an absolute path, this method returns . or contains one or more of the invalid characters defined in . or is .
Combines three strings into a path.The first path to combine.The second path to combine.The third path to combine.The combined paths., , or contains one or more of the invalid characters defined in ., , or is .
Combines four strings into a path.The first path to combine.The second path to combine.The third path to combine.The fourth path to combine.The combined paths., , , or contains one or more of the invalid characters defined in ., , , or is .
Returns the directory information for the specified path string.The path of a file or directory.Directory information for , or if denotes a root directory or is null. Returns if does not contain directory information.The parameter contains invalid characters, is empty, or contains only white spaces.In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, , instead.
The parameter is longer than the system-defined maximum length.
Returns the extension (including the period ".") of the specified path string.The path string from which to get the extension.The extension of the specified path (including the period "."), or , or . If is , returns . If does not have extension information, returns . contains one or more of the invalid characters defined in .
Returns the file name and extension of the specified path string.The path string from which to obtain the file name and extension.The characters after the last directory separator character in . If the last character of is a directory or volume separator character, this method returns . If is , this method returns . contains one or more of the invalid characters defined in .
Returns the file name of the specified path string without the extension.The path of the file.The string returned by , minus the last period (.) and all characters following it. contains one or more of the invalid characters defined in .
Returns the absolute path for the specified path string.The file or directory for which to obtain absolute path information.The fully qualified location of , such as "C:\MyFile.txt". is a zero-length string, contains only white space, or contains one or more of the invalid characters defined in .
-or-
The system could not retrieve the absolute path.The caller does not have the required permissions. is . contains a colon (":") that is not part of a volume identifier (for example, "c:\").The specified path, file name, or both exceed the system-defined maximum length.
Returns an absolute path from a fully qualified base path and a relative path.A relative path to concatenate to .The beginning of a fully qualified path.The absolute path. or is . is not a fully qualified path.
-or-
or contains invalid path characters, such as U+0000.
Gets an array containing the characters that are not allowed in file names.An array containing the characters that are not allowed in file names.
Gets an array containing the characters that are not allowed in path names.An array containing the characters that are not allowed in path names.
Gets the root directory information of the specified path.The path from which to obtain root directory information.The root directory of , or if is , or an empty string if does not contain root directory information. contains one or more of the invalid characters defined in .
-or-
was passed to .
Returns a random folder name or file name.A random folder name or file name.
Creates a uniquely named, zero-byte temporary file on disk and returns the full path of that file.The full path of the temporary file.An I/O error occurs, such as no unique temporary file name is available.
-or-
This method was unable to create a temporary file.
Returns the path of the current user's temporary folder.The path to the temporary folder, ending with a backslash.The caller does not have the required permissions.
Determines whether a path includes a file name extension.The path to search for an extension. if the characters that follow the last directory separator (\\ or /) or volume separator (:) in the path include a period (.) followed by one or more characters; otherwise, . contains one or more of the invalid characters defined in .
Returns a value indicating whether the specified path string contains a root.The path to test. if contains a root; otherwise, . contains one or more of the invalid characters defined in .
Returns a value that indicates whether the specified file path is fixed to a specific drive or UNC path.A file path. if the path is fixed to a specific drive or UNC path; if the path is relative to the current drive or working directory. is .
Returns a relative path from one path to another.The source path the result should be relative to. This path is always considered to be a directory.The destination path.The relative path, or if the paths don't share the same root. or is .
Concatenates two path components into a single path.A character span that contains the first path to join.A character span that contains the second path to join.The combined paths.
Concatenates three path components into a single path.A character span that contains the first path to join.A character span that contains the second path to join.A character span that contains the third path to join.The concatenated path.
Attempts to concatenate two path components to a single preallocated character span, and returns a value that indicates whether the operation succeeded.A character span that contains the first path to join.A character span that contains the second path to join.A character span that contains the third path to join.A character span to hold the concatenated path.When the method returns, a value that indicates the number of characters written to the . if the concatenation operation is successful; otherwise, .
Attempts to concatenate two path components to a single preallocated character span, and returns a value that indicates whether the operation succeeded.A character span that contains the first path to join.A character span that contains the second path to join.A character span to hold the concatenated path.When the method returns, a value that indicates the number of characters written to the . if the concatenation operation is successful; otherwise, .
Determines whether the path represented by the specified character span includes a file name extension.The path to search for an extension. if the characters that follow the last directory separator character or volume separator in the path include a period (".") followed by one or more characters; otherwise, .
Returns a value that indicates whether the file path represented by the specified character span is fixed to a specific drive or UNC path.A file path. if the path is fixed to a specific drive or UNC path; if the path is relative to the current drive or working directory.
Returns a value that indicates whether the specified character span that represents a file path contains a root.The path to test. if contains a root; otherwise, .
Returns the directory information for the specified path represented by a character span.The path to retrieve the directory information from.Directory information for , or an empty span if is , an empty span, or a root (such as , C:, or \server\share).
Returns the extension of a file path that is represented by a read-only character span.The file path from which to get the extension.The extension of the specified path (including the period, "."), or if does not have extension information.
Returns the file name and extension of a file path that is represented by a read-only character span.A read-only span that contains the path from which to obtain the file name and extension.The characters after the last directory separator character in .
Returns the file name without the extension of a file path that is represented by a read-only character span.A read-only span that contains the path from which to obtain the file name without the extension.The characters in the read-only span returned by , minus the last period (.) and all characters following it.
Gets the root directory information from the path contained in the specified character span.The path from which to obtain root directory information.A character span containing the root directory of path.
Performs operations on instances that contain file or directory path information. These operations are performed in a cross-platform manner.
Provides a platform-specific alternate character used to separate directory levels in a path string that reflects a hierarchical file system organization.
Provides a platform-specific character used to separate directory levels in a path string that reflects a hierarchical file system organization.
Provides a platform-specific array of characters that cannot be specified in path string arguments passed to members of the class.
A platform-specific separator character used to separate path strings in environment variables.
Provides a platform-specific volume separator character.
Changes the extension of a path string.The path information to modify. The path cannot contain any of the characters defined in .The new extension (with or without a leading period). Specify to remove an existing extension from .The modified path information.
On Windows-based desktop platforms, if is or an empty string (""), the path information is returned unmodified. If is , the returned string contains the specified path with its extension removed. If has no extension, and is not , the returned path string contains appended to the end of . contains one or more of the invalid characters defined in .
Combines an array of strings into a path.An array of parts of the path.The combined paths.One of the strings in the array contains one or more of the invalid characters defined in .One of the strings in the array is .
Combines two strings into a path.The first path to combine.The second path to combine.The combined paths. If one of the specified paths is a zero-length string, this method returns the other path. If contains an absolute path, this method returns . or contains one or more of the invalid characters defined in . or is .
Combines three strings into a path.The first path to combine.The second path to combine.The third path to combine.The combined paths., , or contains one or more of the invalid characters defined in ., , or is .
Combines four strings into a path.The first path to combine.The second path to combine.The third path to combine.The fourth path to combine.The combined paths., , , or contains one or more of the invalid characters defined in ., , , or is .
Returns the directory information for the specified path string.The path of a file or directory.Directory information for , or if denotes a root directory or is null. Returns if does not contain directory information.The parameter contains invalid characters, is empty, or contains only white spaces.In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, , instead.
The parameter is longer than the system-defined maximum length.
Returns the extension (including the period ".") of the specified path string.The path string from which to get the extension.The extension of the specified path (including the period "."), or , or . If is , returns . If does not have extension information, returns . contains one or more of the invalid characters defined in .
Returns the file name and extension of the specified path string.The path string from which to obtain the file name and extension.The characters after the last directory separator character in . If the last character of is a directory or volume separator character, this method returns . If is , this method returns . contains one or more of the invalid characters defined in .
Returns the file name of the specified path string without the extension.The path of the file.The string returned by , minus the last period (.) and all characters following it. contains one or more of the invalid characters defined in .
Returns the absolute path for the specified path string.The file or directory for which to obtain absolute path information.The fully qualified location of , such as "C:\MyFile.txt". is a zero-length string, contains only white space, or contains one or more of the invalid characters defined in .
-or-
The system could not retrieve the absolute path.The caller does not have the required permissions. is . contains a colon (":") that is not part of a volume identifier (for example, "c:\").The specified path, file name, or both exceed the system-defined maximum length.
Returns an absolute path from a fully qualified base path and a relative path.A relative path to concatenate to .The beginning of a fully qualified path.The absolute path. or is . is not a fully qualified path.
-or-
or contains invalid path characters, such as U+0000.
Gets an array containing the characters that are not allowed in file names.An array containing the characters that are not allowed in file names.
Gets an array containing the characters that are not allowed in path names.An array containing the characters that are not allowed in path names.
Gets the root directory information of the specified path.The path from which to obtain root directory information.The root directory of , or if is , or an empty string if does not contain root directory information. contains one or more of the invalid characters defined in .
-or-
was passed to .
Returns a random folder name or file name.A random folder name or file name.
Creates a uniquely named, zero-byte temporary file on disk and returns the full path of that file.The full path of the temporary file.An I/O error occurs, such as no unique temporary file name is available.
-or-
This method was unable to create a temporary file.
Returns the path of the current user's temporary folder.The path to the temporary folder, ending with a backslash.The caller does not have the required permissions.
Determines whether a path includes a file name extension.The path to search for an extension. if the characters that follow the last directory separator (\\ or /) or volume separator (:) in the path include a period (.) followed by one or more characters; otherwise, . contains one or more of the invalid characters defined in .
Returns a value that indicates whether the specified file path is fixed to a specific drive or UNC path.A file path. if the path is fixed to a specific drive or UNC path; if the path is relative to the current drive or working directory. is .
Returns a relative path from one path to another.The source path the result should be relative to. This path is always considered to be a directory.The destination path.The relative path, or if the paths don't share the same root. or is .
Concatenates two path components into a single path.A character span that contains the first path to join.A character span that contains the second path to join.The combined paths.
Concatenates three path components into a single path.A character span that contains the first path to join.A character span that contains the second path to join.A character span that contains the third path to join.The concatenated path.
Attempts to concatenate two path components to a single preallocated character span, and returns a value that indicates whether the operation succeeded.A character span that contains the first path to join.A character span that contains the second path to join.A character span to hold the concatenated path.When the method returns, a value that indicates the number of characters written to the . if the concatenation operation is successful; otherwise, .
Attempts to concatenate two path components to a single preallocated character span, and returns a value that indicates whether the operation succeeded.A character span that contains the first path to join.A character span that contains the second path to join.A character span that contains the third path to join.A character span to hold the concatenated path.When the method returns, a value that indicates the number of characters written to the . if the concatenation operation is successful; otherwise, .
Returns a value indicating whether the specified path string contains a root.The path to test. if contains a root; otherwise, . contains one or more of the invalid characters defined in .
Determines whether the path represented by the specified character span includes a file name extension.The path to search for an extension. if the characters that follow the last directory separator character or volume separator in the path include a period (".") followed by one or more characters; otherwise, .
Returns a value that indicates whether the file path represented by the specified character span is fixed to a specific drive or UNC path.A file path. if the path is fixed to a specific drive or UNC path; if the path is relative to the current drive or working directory.
Returns a value that indicates whether the specified character span that represents a file path contains a root.The path to test. if contains a root; otherwise, .
Returns the directory information for the specified path represented by a character span.The path to retrieve the directory information from.Directory information for , or an empty span if is , an empty span, or a root (such as , C:, or \server\share).
Returns the extension of a file path that is represented by a read-only character span.The file path from which to get the extension.The extension of the specified path (including the period, "."), or if does not have extension information.
Returns the file name and extension of a file path that is represented by a read-only character span.A read-only span that contains the path from which to obtain the file name and extension.The characters after the last directory separator character in .
Returns the file name without the extension of a file path that is represented by a read-only character span.A read-only span that contains the path from which to obtain the file name without the extension.The characters in the read-only span returned by , minus the last period (.) and all characters following it.
Gets the root directory information from the path contained in the specified character span.The path from which to obtain root directory information.A character span containing the root directory of path.