FileIOPermissionAccess Enum


指定所请求的文件访问权限的类型。Specifies the type of file access requested.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

public enum class FileIOPermissionAccess
public enum FileIOPermissionAccess
public enum FileIOPermissionAccess
public enum FileIOPermissionAccess
type FileIOPermissionAccess = 
Public Enum FileIOPermissionAccess


AllAccess 15

对一个文件或目录的 AppendReadWritePathDiscovery 访问权限。Append, Read, Write, and PathDiscovery access to a file or directory. AllAccess 表示多个 FileIOPermissionAccess 值,如果将它用作 ArgumentException 方法的 access 参数(它需要单一值),则引发 GetPathList(FileIOPermissionAccess)AllAccess represents multiple FileIOPermissionAccess values and causes an ArgumentException when used as the access parameter for the GetPathList(FileIOPermissionAccess) method, which expects a single value.

Append 4

向文件或目录追加内容的访问权限。Access to append material to a file or directory. FileIOPermissionAccess.Append 访问权限包括创建新的文件和目录的能力。FileIOPermissionAccess.Append access includes the ability to create a new file or directory. 要创建文件,还必须同时向代码授予 Append 权限和 WriteRead 权限。To create files, code must also be granted bothAppend and either Write or Read access.

NoAccess 0

没有对文件和目录的访问权限。No access to a file or directory. NoAccess 不表示有效的 FileIOPermissionAccess 值,如果将它用作 ArgumentException 的参数(它需要单一值),则引发 GetPathList(FileIOPermissionAccess)NoAccess represents no valid FileIOPermissionAccess values and causes an ArgumentException when used as the parameter for GetPathList(FileIOPermissionAccess), which expects a single value.

PathDiscovery 8

对路径本身中的信息的访问权限。Access to the information in the path itself. 这可以保护路径中的敏感信息(如用户名)以及有关路径中显示的目录结构的信息。This helps protect sensitive information in the path, such as user names, as well as information about the directory structure revealed in the path. 此值不授予对路径所指代的文件或文件夹的访问权限。This value does not grant access to files or folders represented by the path.

出于性能原因,应仅向目录授予 PathDiscovery,而不向文件授予该权限。For performance reasons, PathDiscovery should only be granted to directories, not to files. 例如,应向诸如 C:\test 和 C:\testPathDiscovery 等路径授予 \\ 权限,而不向 C:\test\example.txt 授予该权限。For example, PathDiscovery permission should be granted to paths such as C:\test and C:\test\\, not C:\test\example.txt.

Read 1

从文件或目录中读取的访问权限。Access to read from a file or directory.

Write 2

写入或删除文件或目录的访问权限。Access to write to or delete a file or directory. Write 访问权限包括对文件和目录的删除和覆盖。Write access includes deleting and overwriting files or directories.


此枚举与 FileIOPermission 类一起使用。This enumeration is used with the FileIOPermission class.


向程序集授予 Write 访问权限类似于向其授予完全信任。Giving Write access to an assembly is similar to granting it Full Trust. 如果应用程序不应写入文件系统,则它不应具有写访问权限。If an application should not write to the file system, it should not have Write access.

尽管 NoAccessAllAccessFileIOPermissionAccess的成员,但它们对于用作 GetPathList 的参数是无效的,因为它们分别描述没有文件访问类型或所有文件访问类型。Although NoAccess and AllAccess are members of FileIOPermissionAccess, they are not valid for use as the parameter for GetPathList because they describe no file access types or all file access types, respectively. FileIOPermission.GetPathList 要求使用单个文件访问类型。FileIOPermission.GetPathList expects a single file access type.

Applies to

See also