FileSystemAclExtensions.SetAccessControl 方法

定义

重载

SetAccessControl(DirectoryInfo, DirectorySecurity)

更改现有目录的安全属性。Changes the security attributes of an existing directory.

SetAccessControl(FileInfo, FileSecurity)

更改现有文件的安全属性。Changes the security attributes of an existing file.

SetAccessControl(FileStream, FileSecurity)

更改现有文件的安全属性。Changes the security attributes of an existing file.

SetAccessControl(DirectoryInfo, DirectorySecurity)

更改现有目录的安全属性。Changes the security attributes of an existing directory.

public:
[System::Runtime::CompilerServices::Extension]
 static void SetAccessControl(System::IO::DirectoryInfo ^ directoryInfo, System::Security::AccessControl::DirectorySecurity ^ directorySecurity);
public static void SetAccessControl (this System.IO.DirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity);
static member SetAccessControl : System.IO.DirectoryInfo * System.Security.AccessControl.DirectorySecurity -> unit

参数

directoryInfo
DirectoryInfo

一个现有目录。An existing directory.

directorySecurity
DirectorySecurity

应用于目录的安全信息。The security information to apply to the directory.

异常

directorySecuritynulldirectorySecurity is null.

SetAccessControl(FileInfo, FileSecurity)

更改现有文件的安全属性。Changes the security attributes of an existing file.

public:
[System::Runtime::CompilerServices::Extension]
 static void SetAccessControl(System::IO::FileInfo ^ fileInfo, System::Security::AccessControl::FileSecurity ^ fileSecurity);
public static void SetAccessControl (this System.IO.FileInfo fileInfo, System.Security.AccessControl.FileSecurity fileSecurity);
static member SetAccessControl : System.IO.FileInfo * System.Security.AccessControl.FileSecurity -> unit

参数

fileInfo
FileInfo

一个现有文件。An existing file.

fileSecurity
FileSecurity

应用于文件的安全信息。The security information to apply to the file.

异常

fileSecuritynullfileSecurity is null.

SetAccessControl(FileStream, FileSecurity)

更改现有文件的安全属性。Changes the security attributes of an existing file.

public:
[System::Runtime::CompilerServices::Extension]
 static void SetAccessControl(System::IO::FileStream ^ fileStream, System::Security::AccessControl::FileSecurity ^ fileSecurity);
public static void SetAccessControl (this System.IO.FileStream fileStream, System.Security.AccessControl.FileSecurity fileSecurity);
static member SetAccessControl : System.IO.FileStream * System.Security.AccessControl.FileSecurity -> unit

参数

fileStream
FileStream

一个现有文件。An existing file.

fileSecurity
FileSecurity

应用于文件的安全信息。The security information to apply to the file.

异常

fileStreamfileSecuritynullfileStream or fileSecurity is null.

文件流已关闭。The file stream is closed.

适用于