- rule
- A System.Security.AccessControl.FileSystemAccessRule object that represents an access control list (ACL) permission to set for a file or directory.
The FileSystemSecurity.SetAccessRule(FileSystemAccessRule) method adds the specified access control list (ACL) rule or overwrites any identical ACL rules that match the System.Security.AccessControl.FileSystemRights value of the rule parameter. For example, if the rule parameter specifies a FileSystemRights.Read value and the FileSystemSecurity.SetAccessRule(FileSystemAccessRule) method finds an identical ACL rule that specifies the FileSystemRights.Read value, the identical rule will be overwritten. If the FileSystemSecurity.SetAccessRule(FileSystemAccessRule) method finds an identical ACL rule that specifies the FileSystemRights.Write value, the identical rule will not be overwritten.
To persist new or changed ACL information to a file, use the System.IO.File.SetAccessControl(string, FileSecurity) or System.IO.FileInfo.SetAccessControl(FileSecurity) method. To persist new or changed ACL information to a directory, use the System.IO.Directory.SetAccessControl(string, DirectorySecurity) or System.IO.FileInfo.SetAccessControl(FileSecurity) method.
To retrieve ACL information from a file, use the erload:System.IO.File.GetAccessControl or erload:System.IO.FileInfo.GetAccessControl method. To retrieve ACL information from a directory, use the erload:System.IO.Directory.GetAccessControl or erload:System.IO.DirectoryInfo.GetAccessControl method.