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将值作为其构造函数的参数。

适用于