本文整理汇总了C#中System.Security.Util.TokenBasedSet.RemoveItem方法的典型用法代码示例。如果您正苦于以下问题:C# TokenBasedSet.RemoveItem方法的具体用法?C# TokenBasedSet.RemoveItem怎么用?C# TokenBasedSet.RemoveItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Util.TokenBasedSet
的用法示例。
在下文中一共展示了TokenBasedSet.RemoveItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MergeDeniedSet
internal virtual void MergeDeniedSet( TokenBasedSet denied )
{
if (denied == null)
return;
int minMaxIndex;
if (this.m_maxIndex < denied.m_maxIndex)
{
minMaxIndex = this.m_maxIndex;
for (int i = this.m_maxIndex + 1; i <= denied.m_maxIndex; ++i)
{
denied.RemoveItem(i);
}
}
else
{
minMaxIndex = denied.m_maxIndex;
}
IPermission p1;
IPermission p2;
for (int i = 0; i<=minMaxIndex ; i++)
{
p1 = (IPermission)this.GetItem(i);
p2 = (IPermission)denied.GetItem(i);
if (p1 != null)
{
if (p2 != null && p1.IsSubsetOf(p2))
{
// If the permission appears in both sets, we can remove it from both
// (i.e. now it's not granted instead of being denied)
this.RemoveItem(i);
denied.RemoveItem(i);
}
}
else if (p2 != null)
{
// If we tried to deny it and it wasn't granted, just remove it from the denied set.
denied.RemoveItem(i);
}
}
}
示例2: GenericIntersect
private void GenericIntersect( TokenBasedSet target, TokenBasedSet other )
{
// Note: Assumes target set is large enough and empty.
int thisMaxIndex = this.m_maxIndex;
int otherMaxIndex = other != null ? other.m_maxIndex : 0;
int minMaxIndex = thisMaxIndex < otherMaxIndex ? thisMaxIndex : otherMaxIndex;
// We want to save any exceptions that occur and throw them at the end.
Exception savedException = null;
for (int i = 0; i <= minMaxIndex; i++)
{
try
{
IPermission p1 = other != null ? (IPermission)other.m_objSet[i] : null;
IPermission p2 = (IPermission)this.m_objSet[i];
if (p1 != null && p2 != null)
{
target.SetItem( i, p1.Intersect(p2) );
}
else
{
target.SetItem( i, null );
}
}
catch (Exception e)
{
if (savedException == null)
savedException = e;
// Remove the permission from the intersection set
target.SetItem( i, null );
}
}
if (minMaxIndex == otherMaxIndex)
{
for (int i = otherMaxIndex+1; i <= target.m_maxIndex; ++i)
{
target.RemoveItem( i );
}
}
if (savedException != null)
throw savedException;
}