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.