当前位置: 首页>>代码示例>>C#>>正文


C# TokenBasedSet.RemoveItem方法代码示例

本文整理汇总了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); 
                }
            }
    
        }
开发者ID:ArildF,项目名称:masters,代码行数:45,代码来源:tokenbasedset.cs

示例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;
 }
开发者ID:ArildF,项目名称:masters,代码行数:47,代码来源:tokenbasedset.cs


注:本文中的System.Security.Util.TokenBasedSet.RemoveItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。