PermissionSet 类

定义

注意

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

表示可以包含许多不同类型的权限的集合。

public ref class PermissionSet : System::Collections::ICollection, System::Runtime::Serialization::IDeserializationCallback, System::Security::ISecurityEncodable, System::Security::IStackWalk
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public class PermissionSet : System.Collections.ICollection, System.Runtime.Serialization.IDeserializationCallback, System.Security.ISecurityEncodable, System.Security.IStackWalk
public class PermissionSet : System.Collections.ICollection, System.Runtime.Serialization.IDeserializationCallback, System.Security.ISecurityEncodable, System.Security.IStackWalk
[System.Serializable]
public class PermissionSet : System.Collections.ICollection, System.Runtime.Serialization.IDeserializationCallback, System.Security.ISecurityEncodable, System.Security.IStackWalk
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class PermissionSet : System.Collections.ICollection, System.Runtime.Serialization.IDeserializationCallback, System.Security.ISecurityEncodable, System.Security.IStackWalk
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type PermissionSet = class
    interface ICollection
    interface IEnumerable
    interface IDeserializationCallback
    interface ISecurityEncodable
    interface IStackWalk
type PermissionSet = class
    interface ICollection
    interface IEnumerable
    interface IDeserializationCallback
    interface ISecurityEncodable
    interface IStackWalk
[<System.Serializable>]
type PermissionSet = class
    interface ISecurityEncodable
    interface ICollection
    interface IEnumerable
    interface IStackWalk
    interface IDeserializationCallback
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type PermissionSet = class
    interface ISecurityEncodable
    interface ICollection
    interface IEnumerable
    interface IStackWalk
    interface IDeserializationCallback
Public Class PermissionSet
Implements ICollection, IDeserializationCallback, ISecurityEncodable, IStackWalk
继承
PermissionSet
派生
属性
实现

注解

Caution

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

可以使用 PermissionSet 这些操作以组的形式对多个不同的权限执行操作。

构造函数

名称 说明
PermissionSet(PermissionSet)
已过时.

使用从PermissionSet参数获取的初始值初始化类的新实例permSet

PermissionSet(PermissionState)
已过时.

用指定的PermissionSet值初始化类的新实例PermissionState

属性

名称 说明
Count
已过时.

获取权限集中包含的权限对象数。

IsReadOnly
已过时.

获取一个值,该值指示集合是否为只读。

IsSynchronized
已过时.

获取一个值,该值指示集合是否保证为线程安全。

SyncRoot
已过时.

获取当前集合的根对象。

方法

名称 说明
AddPermission(IPermission)
已过时.

向 <a0/a0> 添加指定权限。

AddPermissionImpl(IPermission)
已过时.

向 <a0/a0> 添加指定权限。

Assert()
已过时.

声明调用代码可以通过调用此方法的代码访问受权限需求保护的资源,即使堆栈中的调用方尚未获得访问资源的权限。 使用 Assert() 可能会创建安全漏洞。

ContainsNonCodeAccessPermissions()
已过时.

获取一个值,该值指示 PermissionSet 是否包含不派生自 CodeAccessPermission的权限。

ConvertPermissionSet(String, Byte[], String)
已过时.
已过时.

将编码 PermissionSet 格式从一种 XML 编码格式转换为另一种 XML 编码格式。

Copy()
已过时.

创建 . PermissionSet的副本。

CopyTo(Array, Int32)
已过时.

将集的权限对象复制到一个 Array指示的位置。

Demand()
已过时.

SecurityException如果在调用堆栈中更高的所有调用方尚未被授予当前实例指定的权限,则强制在运行时执行该操作。

Deny()
已过时.
已过时.

导致任何 Demand() 通过调用代码传递的权限,该权限具有与当前 PermissionSet 中包含的类型的权限相交的权限失败。

Equals(Object)
已过时.

确定指定的 PermissionSetNamedPermissionSet 对象是否等于当前 PermissionSet

Equals(Object)
已过时.

确定指定的对象是否等于当前对象。

(继承自 Object)
FromXml(SecurityElement)
已过时.

从 XML 编码重新构造具有指定状态的安全对象。

GetEnumerator()
已过时.

返回集权限的枚举器。

GetEnumeratorImpl()
已过时.

返回集权限的枚举器。

GetHashCode()
已过时.

获取适合用于哈希算法和数据结构(如哈希表)的对象的哈希代码 PermissionSet

GetHashCode()
已过时.

用作默认哈希函数。

(继承自 Object)
GetPermission(Type)
已过时.

获取指定类型的权限对象(如果该对象存在于集中)。

GetPermissionImpl(Type)
已过时.

获取指定类型的权限对象(如果该对象存在于集中)。

GetType()
已过时.

获取当前实例的 Type

(继承自 Object)
Intersect(PermissionSet)
已过时.

创建并返回一个权限集,该集是当前 PermissionSet 和指定 PermissionSet项的交集。

IsEmpty()
已过时.

获取一个值,该值指示是否为 PermissionSet 空。

IsSubsetOf(PermissionSet)
已过时.

确定当前 PermissionSet 是否为指定 PermissionSet子集的子集。

IsUnrestricted()
已过时.

确定是否为 PermissionSetUnrestricted.

MemberwiseClone()
已过时.

创建当前 Object的浅表副本。

(继承自 Object)
PermitOnly()
已过时.

导致任何Demand()传递调用代码的任何不是当前PermissionSet子集的PermissionSet调用代码失败。

RemovePermission(Type)
已过时.

从集中删除特定类型的权限。

RemovePermissionImpl(Type)
已过时.

从集中删除特定类型的权限。

RevertAssert()
已过时.

导致删除当前帧之前的任何 Assert() 帧,并且不再生效。

SetPermission(IPermission)
已过时.

设置权限, PermissionSet替换同一类型的任何现有权限。

SetPermissionImpl(IPermission)
已过时.

设置权限, PermissionSet替换同一类型的任何现有权限。

ToString()
已过时.

返回一 PermissionSet个字符串表示形式。

ToXml()
已过时.

创建安全对象的 XML 编码及其当前状态。

Union(PermissionSet)
已过时.

创建一个 PermissionSet 是当前 PermissionSet 和指定 PermissionSet项的并集。

显式接口实现

名称 说明
IDeserializationCallback.OnDeserialization(Object)
已过时.

反序列化整个对象图时运行。

扩展方法

名称 说明
AsParallel(IEnumerable)
已过时.

启用查询的并行化。

AsQueryable(IEnumerable)
已过时.

IEnumerable 转换为 IQueryable

Cast<TResult>(IEnumerable)
已过时.

IEnumerable 的元素强制转换为指定类型。

OfType<TResult>(IEnumerable)
已过时.

根据指定类型筛选 IEnumerable 的元素。

适用于