PermissionState 列舉

定義

警告

Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}

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

public enum class PermissionState
public enum PermissionState
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public enum PermissionState
[System.Serializable]
public enum PermissionState
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public enum PermissionState
type PermissionState = 
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type PermissionState = 
[<System.Serializable>]
type PermissionState = 
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type PermissionState = 
Public Enum PermissionState
繼承
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.

適用於