本文整理汇总了C#中System.Security.Permissions.KeyContainerPermission.IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# KeyContainerPermission.IsEmpty方法的具体用法?C# KeyContainerPermission.IsEmpty怎么用?C# KeyContainerPermission.IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Permissions.KeyContainerPermission
的用法示例。
在下文中一共展示了KeyContainerPermission.IsEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Intersect
public override IPermission Intersect (IPermission target) {
if (target == null)
return null;
if (!VerifyType(target))
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", this.GetType().FullName));
KeyContainerPermission operand = (KeyContainerPermission) target;
if (this.IsEmpty() || operand.IsEmpty())
return null;
KeyContainerPermissionFlags flags_intersect = operand.m_flags & this.m_flags;
KeyContainerPermission cp = new KeyContainerPermission(flags_intersect);
foreach (KeyContainerPermissionAccessEntry accessEntry in AccessEntries) {
cp.AddAccessEntryAndIntersect(accessEntry, operand);
}
foreach (KeyContainerPermissionAccessEntry accessEntry in operand.AccessEntries) {
cp.AddAccessEntryAndIntersect(accessEntry, this);
}
return cp.IsEmpty() ? null : cp;
}
示例2: Union
public override IPermission Union (IPermission target) {
if (target == null)
return this.Copy();
if (!VerifyType(target))
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", this.GetType().FullName));
KeyContainerPermission operand = (KeyContainerPermission) target;
if (this.IsUnrestricted() || operand.IsUnrestricted())
return new KeyContainerPermission(PermissionState.Unrestricted);
KeyContainerPermissionFlags flags_union = (KeyContainerPermissionFlags) (m_flags | operand.m_flags);
KeyContainerPermission cp = new KeyContainerPermission(flags_union);
foreach (KeyContainerPermissionAccessEntry accessEntry in AccessEntries) {
cp.AddAccessEntryAndUnion(accessEntry, operand);
}
foreach (KeyContainerPermissionAccessEntry accessEntry in operand.AccessEntries) {
cp.AddAccessEntryAndUnion(accessEntry, this);
}
return cp.IsEmpty() ? null : cp;
}
示例3: Union
public override IPermission Union(IPermission target)
{
if (target == null)
{
return this.Copy();
}
if (!base.VerifyType(target))
{
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", new object[] { base.GetType().FullName }));
}
KeyContainerPermission permission = (KeyContainerPermission) target;
if (this.IsUnrestricted() || permission.IsUnrestricted())
{
return new KeyContainerPermission(PermissionState.Unrestricted);
}
KeyContainerPermissionFlags flags = this.m_flags | permission.m_flags;
KeyContainerPermission permission2 = new KeyContainerPermission(flags);
KeyContainerPermissionAccessEntryEnumerator enumerator = this.AccessEntries.GetEnumerator();
while (enumerator.MoveNext())
{
KeyContainerPermissionAccessEntry current = enumerator.Current;
permission2.AddAccessEntryAndUnion(current, permission);
}
KeyContainerPermissionAccessEntryEnumerator enumerator2 = permission.AccessEntries.GetEnumerator();
while (enumerator2.MoveNext())
{
KeyContainerPermissionAccessEntry accessEntry = enumerator2.Current;
permission2.AddAccessEntryAndUnion(accessEntry, this);
}
if (!permission2.IsEmpty())
{
return permission2;
}
return null;
}