PermissionState 枚举

定义

注意

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

指定权限在创建时是否应具有对资源的所有或无访问权限。

public enum class 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
public enum PermissionState
[System.Serializable]
public enum PermissionState
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
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}")>]
type PermissionState = 
type PermissionState = 
[<System.Serializable>]
type PermissionState = 
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type PermissionState = 
Public Enum PermissionState
继承
PermissionState
属性

字段

名称 说明
None 0

无权访问受权限保护的资源。

Unrestricted 1

对受权限保护的资源的完全访问权限。

注解

Caution

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

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

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

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

适用于