File.SetAttributes Method (String, FileAttributes)
Sets the specified FileAttributes of the file on the specified path.
Assembly: mscorlib (in mscorlib.dll)
path 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. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
path is in an invalid format.
The specified path is invalid, (for example, it is on an unmapped drive).
The file cannot be found.
path specified a file that is read-only.
This operation is not supported on the current platform.
path specified a directory.
The caller does not have the required permission.
The path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see GetCurrentDirectory.
It is not possible to change the compression status of a File object using the method.
For a list of common I/O tasks, see Common I/O Tasks.
Available since 10
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.0