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


C# SecurityElement.ConvertSecurityElementFactories方法代码示例

本文整理汇总了C#中System.Security.SecurityElement.ConvertSecurityElementFactories方法的典型用法代码示例。如果您正苦于以下问题:C# SecurityElement.ConvertSecurityElementFactories方法的具体用法?C# SecurityElement.ConvertSecurityElementFactories怎么用?C# SecurityElement.ConvertSecurityElementFactories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Security.SecurityElement的用法示例。


在下文中一共展示了SecurityElement.ConvertSecurityElementFactories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Equal

        public bool Equal( SecurityElement other )
        {
            if (other == null)
                return false;
        
            // Check if the tags are the same
            if (!String.Equals(m_strTag, other.m_strTag))
                return false;

            // Check if the text is the same
            if (!String.Equals(m_strText, other.m_strText))
                return false;

            // Check if the attributes are the same and appear in the same
            // order.
            
            // Maybe we can get away by only checking the number of attributes
            if (m_lAttributes == null || other.m_lAttributes == null)
            {
                if (m_lAttributes != other.m_lAttributes)
                    return false;
            }
            else 
            {                
                int iMax = m_lAttributes.Count;
                Debug.Assert( iMax % 2 == 0, "Odd number of strings means the attr/value pairs were not added correctly" );

                if (iMax != other.m_lAttributes.Count)
                    return false;
                          
                for (int i = 0; i < iMax; i++)
                {
                    String lhs = (String)m_lAttributes[i];
                    String rhs = (String)other.m_lAttributes[i];
                    
                    if (!String.Equals(lhs, rhs))
                        return false;
                }
            }

            // Finally we must check the child and make sure they are
            // equal and in the same order
            
            // Maybe we can get away by only checking the number of children
            if (m_lChildren == null || other.m_lChildren == null) 
            {
                if (m_lChildren != other.m_lChildren)
                    return false;
            } 
            else 
            {
                if (m_lChildren.Count != other.m_lChildren.Count)
                    return false;

                this.ConvertSecurityElementFactories();
                other.ConvertSecurityElementFactories();

                // Okay, we'll need to go through each one of them
                IEnumerator lhs = m_lChildren.GetEnumerator();
                IEnumerator rhs = other.m_lChildren.GetEnumerator();

                SecurityElement e1, e2;
                while (lhs.MoveNext())
                {
                    rhs.MoveNext();
                    e1 = (SecurityElement)lhs.Current;
                    e2 = (SecurityElement)rhs.Current;       
                    if (e1 == null || !e1.Equal(e2))                
                        return false;
                }
            }
            return true;
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:73,代码来源:SecurityElement.cs

示例2: Equal

 public bool Equal(SecurityElement other)
 {
     if (other == null)
     {
         return false;
     }
     if (!string.Equals(this.m_strTag, other.m_strTag))
     {
         return false;
     }
     if (!string.Equals(this.m_strText, other.m_strText))
     {
         return false;
     }
     if ((this.m_lAttributes == null) || (other.m_lAttributes == null))
     {
         if (this.m_lAttributes != other.m_lAttributes)
         {
             return false;
         }
     }
     else
     {
         int count = this.m_lAttributes.Count;
         if (count != other.m_lAttributes.Count)
         {
             return false;
         }
         for (int i = 0; i < count; i++)
         {
             string a = (string) this.m_lAttributes[i];
             string b = (string) other.m_lAttributes[i];
             if (!string.Equals(a, b))
             {
                 return false;
             }
         }
     }
     if ((this.m_lChildren == null) || (other.m_lChildren == null))
     {
         if (this.m_lChildren != other.m_lChildren)
         {
             return false;
         }
     }
     else
     {
         if (this.m_lChildren.Count != other.m_lChildren.Count)
         {
             return false;
         }
         this.ConvertSecurityElementFactories();
         other.ConvertSecurityElementFactories();
         IEnumerator enumerator = this.m_lChildren.GetEnumerator();
         IEnumerator enumerator2 = other.m_lChildren.GetEnumerator();
         while (enumerator.MoveNext())
         {
             enumerator2.MoveNext();
             SecurityElement current = (SecurityElement) enumerator.Current;
             SecurityElement element2 = (SecurityElement) enumerator2.Current;
             if ((current == null) || !current.Equal(element2))
             {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:68,代码来源:SecurityElement.cs


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