PermissionState PermissionState PermissionState PermissionState Enum


指定在建立時使用權限應該擁有資源檔的所有存取權還是沒有任何的存取權限。Specifies whether a permission should have all or no access to resources at creation.

public enum class PermissionState
public enum PermissionState
type PermissionState = 
Public Enum PermissionState


None None None None 0

不允許存取使用權限所保護的資源。No access to the resource protected by the permission.

Unrestricted Unrestricted Unrestricted Unrestricted 1

允許存取使用權限所保護的資源。Full access to the resource protected by the permission.


權限可以建立完全限制或完全不受限制的狀態。Permissions can be created in either a totally restrictive or totally unrestrictive state. 完全限制狀態可讓無法存取資源;完全不受限制的狀態可讓所有存取特定資源。A totally restrictive state allows no access to resources; a totally unrestricted state allows all access to a particular resource. 例如,檔案權限建構函式無法建立物件,代表沒有存取權的任何檔案或所有檔案的所有存取。For example, the file permission constructor could create an object representing either no access to any files or all access to all files.

每一種權限會清楚地定義狀態,或全部不表示的型別內的權限。Each type of permission clearly defines extreme states representing either all or none of the permissions expressible within the type. 因此,就可以在完全限制或無限制不知情的情況下的特定使用權限狀態; 建立一般的權限不過,可以只設定中繼狀態,根據特定的使用權限語意。Thus, it is possible to create a generic permission in a completely restricted or unrestricted state without knowledge of the particular permission; however, intermediate states can only be set according to the specific permission semantics.

所有.NET Framework 中實作的程式碼存取權限可能都需要PermissionState作為其建構函式的引數的值。All code access permissions implemented in the .NET Framework can take a PermissionState value as an argument to their constructor.