Share via


PermissionState 枚举

定义

注意

Code Access Security is not supported or honored by the runtime.

指定权限在创建时是否对资源有所有访问权限或没有任何访问权限。

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

不能对该权限所保护的资源进行访问。

Unrestricted 1

可以对该权限所保护的资源进行完全访问。

注解

注意

代码访问安全性 (CAS) 已在所有版本的 .NET Framework 和 .NET 中弃用。 如果使用与 CAS 相关的 API,最新版本的 .NET 不会遵循 CAS 注释,并会生成错误。 开发人员应寻求用于完成安全任务的替代方法。

可以在完全限制或完全不受限制的状态中创建权限。 完全限制状态允许不访问资源;完全不受限制的状态允许对特定资源的所有访问。 例如,文件权限构造函数可以创建一个对象,表示不访问任何文件或对所有文件的所有访问权限。

每种类型的权限都明确定义极端状态,表示类型中可表达的所有权限或全部权限。 因此,在不知道特定权限的情况下,可以在完全受限或不受限制的状态下创建通用权限;但是,只能根据特定的权限语义设置中间状态。

.NET Framework 中实现的所有代码访问权限都可以将值PermissionState作为其构造函数的参数。

适用于