FileIOPermissionAccess 列舉


指定要求的檔案存取權類型。Specifies the type of file access requested.

此列舉具有 FlagsAttribute 個屬性允許以位元方式合併其成員值。

public enum class 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. 若要建立檔案,程式碼也必須獲授與 AppendWriteRead 存取權。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. 例如,PathDiscovery 權限應該授與諸如 C:\test 與 C:\test 的路徑\\,而非 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.