PnrpPermission.IsSubsetOf(IPermission) 方法
定义
确定当前 PnrpPermission 是否为指定权限的子集。Determines whether the current PnrpPermission is a subset of the specified permission.
public:
override bool IsSubsetOf(System::Security::IPermission ^ target);
public override bool IsSubsetOf (System.Security.IPermission target);
override this.IsSubsetOf : System.Security.IPermission -> bool
Public Overrides Function IsSubsetOf (target As IPermission) As Boolean
参数
- target
- IPermission
将要测试子集关系的权限。A permission that is to be tested for the subset relationship. 此权限必须与当前权限属于同一类型。This permission must be of the same type as the current permission.
返回
如果当前 PnrpPermission 是指定权限的子集,则为 true;否则为 false。true if the current PnrpPermission is a subset of the specified permission; otherwise, false.
例外
目标参数不是一个 null 引用(在 Visual Basic 中为 Nothing),并且不是与当前权限相同的类的实例。The target parameter is not a null reference (Nothing in Visual Basic) and is not an instance of the same class as the current permission.
注解
PnrpPermission如果当前权限指定的一组操作完全包含在指定权限中,则当前为指定权限的子集。The current PnrpPermission is a subset of the specified permission if the current permission specifies a set of operations that is wholly contained by the specified permission. 例如,表示对 "C:\example.txt" 的访问权限的权限是表示对 "C: \" 的访问权限的权限子集。For example, a permission that represents access to "C:\example.txt" is a subset of a permission that represents access to "C:\". 如果此方法返回 true ,则当前权限表示对受保护资源的访问权限比指定权限更多。If this method returns true, the current permission represents no more access to the protected resource than does the specified permission.
以下语句 true 对于 IsSubsetOf 方法的所有实现都是必需的。The following statements are required to be true for all implementations of the IsSubsetOf method. X、Y 和 Z 表示 IPermission 不是 null Visual Basic) 中 (引用的对象 Nothing 。X, Y, and Z represent IPermission objects that are not a null reference (Nothing in Visual Basic).
X.IsSubsetOf(X)返回true。X.IsSubsetOf(X)returnstrue.X.IsSubsetOf(Y)如果Y.IsSubsetOf(X)X 和 Y 表示相同的权限集,则返回与相同的值。X.IsSubsetOf(Y)returns the same value asY.IsSubsetOf(X)if and only if X and Y represent the same set of permissions.如果
X.IsSubsetOf(Y)和Y.IsSubsetOf(Z)都返回true,则X.IsSubsetOf(Z)返回true。IfX.IsSubsetOf(Y)andY.IsSubsetOf(Z)both returntrue,X.IsSubsetOf(Z)returnstrue.
如果 X 表示 IPermission 权限状态为 None 的空对象,而 Y 表示作为 IPermission null Visual Basic) 中 (引用的对象,则 Nothing X.IsSubsetOf(Y) 返回 true 。If X represents an empty IPermission object with a permission state of None, and Y represents an IPermission object that is a null reference (Nothing in Visual Basic), X.IsSubsetOf(Y) returns true. 如果 Z 也是空权限,则复合集操作 X.Union(Z).IsSubsetOf(Y) 还会返回, true Union 这是因为两个空权限的都是空的权限。If Z is also an empty permission, the compound set operation X.Union(Z).IsSubsetOf(Y) also returns true because the Union of two empty permissions is an empty permission.