PermissionState 列舉


指定在建立時使用權限應該擁有資源檔的所有存取權還是沒有任何的存取權限。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 0

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

Unrestricted 1

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


許可權可以用完全限制或完全 unrestrictive 的狀態建立。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.