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


C# SortedList.GetKeyList方法代码示例

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


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

示例1: GatherNamespaceToRender

 private void GatherNamespaceToRender(string nsPrefix, SortedList nsListToRender, Hashtable nsLocallyDeclared)
 {
     int num;
     foreach (object obj2 in nsListToRender.GetKeyList())
     {
         if (Utils.HasNamespacePrefix((XmlAttribute) obj2, nsPrefix))
         {
             return;
         }
     }
     XmlAttribute a = (XmlAttribute) nsLocallyDeclared[nsPrefix];
     XmlAttribute nearestRenderedNamespaceWithMatchingPrefix = base.GetNearestRenderedNamespaceWithMatchingPrefix(nsPrefix, out num);
     if (a != null)
     {
         if (Utils.IsNonRedundantNamespaceDecl(a, nearestRenderedNamespaceWithMatchingPrefix))
         {
             nsLocallyDeclared.Remove(nsPrefix);
             nsListToRender.Add(a, null);
         }
     }
     else
     {
         int num2;
         XmlAttribute nearestUnrenderedNamespaceWithMatchingPrefix = base.GetNearestUnrenderedNamespaceWithMatchingPrefix(nsPrefix, out num2);
         if (((nearestUnrenderedNamespaceWithMatchingPrefix != null) && (num2 > num)) && Utils.IsNonRedundantNamespaceDecl(nearestUnrenderedNamespaceWithMatchingPrefix, nearestRenderedNamespaceWithMatchingPrefix))
         {
             nsListToRender.Add(nearestUnrenderedNamespaceWithMatchingPrefix, null);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:ExcAncestralNamespaceContextManager.cs

示例2: LoadRenderedNamespaces

 internal void LoadRenderedNamespaces(SortedList nsRenderedList)
 {
     foreach (object obj2 in nsRenderedList.GetKeyList())
     {
         this.AddRendered((XmlAttribute) obj2);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:AncestralNamespaceContextManager.cs

示例3: TestGetKeyValueList

        public void TestGetKeyValueList()
        {
            var dic1 = new SortedList();

            for (int i = 0; i < 100; i++)
                dic1.Add("Key_" + i, "Value_" + i);

            var ilst1 = dic1.GetKeyList();
            var hsh1 = new Hashtable();

            DoIListTests(dic1, ilst1, hsh1, DicType.Key);

            Assert.False(hsh1.Count != 2
                || !hsh1.ContainsKey("IsReadOnly")
                || !hsh1.ContainsKey("IsFixedSize"), "Error, KeyList");


            dic1 = new SortedList();
            for (int i = 0; i < 100; i++)
                dic1.Add("Key_" + i, "Value_" + i);

            ilst1 = dic1.GetValueList();
            hsh1 = new Hashtable();
            DoIListTests(dic1, ilst1, hsh1, DicType.Value);

            Assert.False(hsh1.Count != 2
                || !hsh1.ContainsKey("IsReadOnly")
                || !hsh1.ContainsKey("IsFixedSize"), "Error, ValueList");
        }
开发者ID:hitomi333,项目名称:corefx,代码行数:29,代码来源:WrapperTests.cs

示例4: GetStudentUserListByYear

 /// <summary>
 /// GetStudentUserListByYear take StudentByYear sorted list created in the main program and the student years checkedlistbox and creates a hashtable
 /// that will be used to look up the user list to display in the combolistbox display. 
 /// This does not use wmi service, but is the logical place add this method. 
 /// </summary>
 /// <param name="slIn"></param>
 /// <param name="checkListBox"></param>
 /// <returns>sortlist</returns>
 public Hashtable GetStudentUserListByYear(SortedList slIn, CheckedListBox checkListBox)
 {
     Hashtable ht = new Hashtable();
     try
     {
         foreach (object itemChecked in checkListBox.CheckedItems)
         {
             ICollection keys = slIn.GetKeyList();
             foreach (string s in keys)
             {
                 if (s == itemChecked.ToString())
                 {
                     //this is the sortedlist of students for a given year
                     IList values = ((SortedList)slIn[s]).GetValueList();
                     //create the hashtable entries available students - this will be used to lookup and match students by year
                     foreach (string name in values)
                     {
                         ht.Add(name.ToUpper(), name.ToUpper());
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         //re-throw exception for main calling
         throw new Exception("WMIPropertiesHelper", e);
     }
     return (ht);
 }
开发者ID:mcdonald1212,项目名称:ServerUtility,代码行数:38,代码来源:ServerUserCleanup.cs

示例5: GetNamespacesToRender

 internal override void GetNamespacesToRender(XmlElement element, SortedList attrListToRender, SortedList nsListToRender, Hashtable nsLocallyDeclared)
 {
     this.GatherNamespaceToRender(element.Prefix, nsListToRender, nsLocallyDeclared);
     foreach (object obj2 in attrListToRender.GetKeyList())
     {
         string prefix = ((XmlAttribute) obj2).Prefix;
         if (prefix.Length > 0)
         {
             this.GatherNamespaceToRender(prefix, nsListToRender, nsLocallyDeclared);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:ExcAncestralNamespaceContextManager.cs

示例6: Main

        static void Main(string[] args)
        {
            ArrayList arr = new ArrayList();
            //выделяет память на 4 элемента, по мере необходимости добавляет ещё на 4
            arr.Add(10);
            arr.Add(2);
            arr.Add(9);
            arr.Add(-2);
            arr.Add(15);
            arr.Add(8);
              //  arr.Add("Vasya");
            arr.Sort();       //Vasya не можем сравнить для сортировки с числами
            arr.TrimToSize();   //устанавливает нужную ёмкость
            Console.WriteLine("Ёмкость: "+arr.Capacity+ "; количество элементов: "+arr.Count);

            foreach (object item in arr)
                Console.Write(item + " ");

            int x = 5;
            arr[0] = x;
            // x = arr[0];      //так нельзя
            x = (int)arr[1];

            Console.WriteLine("\nx = arr[1] => "+x);
            foreach (object item in arr)
                Console.Write(item + " ");

            Console.WriteLine("\n>>>>>>>>>>>>>");

            SortedList slist = new SortedList();
            slist.Add(2, 200);
            slist.Add(1, 300);
            foreach (var item in slist.GetKeyList())
                Console.WriteLine(item);

            Console.ReadKey();
        }
开发者ID:CAHbl4,项目名称:csharp,代码行数:37,代码来源:Program.cs

示例7: Main

    public static void Main(string []args) {
      if (args.Length < 1) {
        Console.WriteLine("please specify the number of p2p nodes."); 
        Environment.Exit(0);
      }
      else if (args.Length < 2) {
        Console.WriteLine("please specify the number of missing edges."); 
        Environment.Exit(0);
      }

      int base_port = 54111;
      int network_size = Int32.Parse(args[0]);
      int missing_edges_count = Int32.Parse(args[1]);
      string brunet_namespace = "testing";
      SortedList nodes = new SortedList();
      Console.WriteLine("Initializing...");

      ArrayList RemoteTA = new ArrayList();
      for(int i = 0; i < network_size; i++) {
        RemoteTA.Add(TransportAddressFactory.CreateInstance("brunet.udp://127.0.0.1:" + (base_port + i)));
      }

      Random rand = new Random();
      for(int i = 0; i < network_size; i++) {
        Console.WriteLine("Starting node: {0}", i);
        AHAddress address = new AHAddress(new RNGCryptoServiceProvider());
        Node node = new StructuredNode(address, brunet_namespace);
        ArrayList arr_tas = new ArrayList();
        for(int j = 0; j < missing_edges_count; j++) {
          int remote_port = 0;
          do {
            remote_port = rand.Next(0, network_size - 1) + base_port;
          } while(remote_port == base_port + i);
          PortTAAuthorizer port_auth = new PortTAAuthorizer(remote_port);
          arr_tas.Add(port_auth);
        }
        arr_tas.Add(new ConstantAuthorizer(TAAuthorizer.Decision.Allow));
        TAAuthorizer ta_auth = new SeriesTAAuthorizer(arr_tas);
        node.AddEdgeListener(new UdpEdgeListener(base_port + i, null, ta_auth));
        node.AddEdgeListener(new Tunnel.TunnelEdgeListener(node));
        node.RemoteTAs = RemoteTA;
        Thread t = new Thread(new ThreadStart(node.Connect));
        t.Start();
        nodes.Add((Address) address, node);
        Console.WriteLine("Sleeping for 2 seconds");
        System.Threading.Thread.Sleep(2000);        
      }

      //wait for 60 more seconds
      int count = 0;
      while(true) {
        Console.WriteLine("Going to sleep for 5 seconds.");
        System.Threading.Thread.Sleep(5000);

        Console.WriteLine("Checking ring...");
        Address start_addr = (Address) nodes.GetKeyList()[0];
        Address curr_addr = start_addr;

        for (int i = 0; i < network_size; i++) {
          Node node = (Node) nodes[curr_addr];
          ConnectionTable con_table = node.ConnectionTable;
          Connection con = con_table.GetLeftStructuredNeighborOf((AHAddress) curr_addr);
          Console.WriteLine("Hop {2}\t Address {0}\n\t Connection to left {1}\n", curr_addr, con, i);
          Address next_addr = con.Address;

          if (next_addr == null) {
            Console.WriteLine("Found disconnection.");
            break;
          }

          Connection lc = ((Node)nodes[next_addr]).ConnectionTable.GetRightStructuredNeighborOf((AHAddress) next_addr);
          if( (lc == null) || !curr_addr.Equals(lc.Address)) {
            Address left_addr = lc.Address;
            Console.WriteLine(curr_addr + " != " + left_addr);
            Console.WriteLine("Right had edge, but left has no record of it!\n{0} != {1}", con, lc);
            break;
          }
          else if(next_addr.Equals(start_addr) && i != network_size -1) {
            Console.WriteLine("Completed circle too early.  Only {0} nodes in the ring.",
                              (i + 1));
            break;
          }
          curr_addr = next_addr;
        }
        count++;
        if(start_addr.Equals(curr_addr)) {
          Console.WriteLine("Ring properly formed!");
          Console.WriteLine("This only took .... {0} seconds", (count * 5));
          break;
        }
      }

      count = 0;
      while(true) {
        Console.WriteLine("Going to sleep for 5 seconds.");
        System.Threading.Thread.Sleep(5000);

        Console.WriteLine("Checking ring...");
        Address start_addr = (Address) nodes.GetKeyList()[0];
        Address curr_addr = start_addr;
//.........这里部分代码省略.........
开发者ID:twchoi,项目名称:tmp-brunet-deetoo,代码行数:101,代码来源:BrokenRingTester.cs

示例8: TestGetValueListBasic


//.........这里部分代码省略.........
            //
            // Constructor: Create SortedList using this as IComparer and default settings.
            //
            sl2 = new SortedList();

            // Verify that the SortedList is not null.
            Assert.NotNull(sl2);

            // Verify that the SortedList is empty.
            Assert.Equal(0, sl2.Count);

            // Testcase: Set - null key, ArgExc expected
            Assert.Throws<ArgumentNullException>(() =>
                {
                    sl2[null] = 0;
                });

            Assert.Equal(0, sl2.Count);

            // Testcase: Set - null val
            sl2[(object)100] = (object)null;
            Assert.Equal(1, sl2.Count);

            // Testcase: vanila Set
            sl2[(object)100] = 1;
            Assert.Equal(1, sl2.Count);
            sl2.Clear();
            Assert.Equal(0, sl2.Count);

            // Testcase: add key-val pairs
            for (i = 0; i < 100; i++)
            {
                sl2.Add(i + 100, i);
            }
            Assert.Equal(100, sl2.Count);

            for (i = 0; i < 100; i++)
            {
                j = i + 100;
                Assert.True(sl2.ContainsKey((int)j));
                Assert.True(sl2.ContainsValue(i));

                object o2 = sl2[(int)j];

                Assert.NotNull(o2);
                Assert.True(o2.Equals(i), "Error, entry for key " + j.ToString() + " is " + o2.ToString() + " but should have been " + i.ToString());
            } // FOR

            //  testcase: GetValueList
            // ICollection.GetEnumerator() first test the boundaries on the Remove method thru GetEnumerator implementation
            en = (IEnumerator)sl2.GetValueList().GetEnumerator();

            // Boundary for Current
            Assert.Throws<InvalidOperationException>(() =>
                    {
                        object throwaway = en.Current;
                    }
            );

            j = 0;
            // go over the enumarator
            en = (IEnumerator)sl2.GetValueList().GetEnumerator();
            while (en.MoveNext())
            {
                // Current to see the order
                i3 = (int)en.Current;
                Assert.Equal(i3, j);

                // GetObject again to see the same order
                i3 = (int)en.Current;
                Assert.Equal(i3, j);

                j++;
            }

            // Boundary for GetObject
            Assert.Throws<InvalidOperationException>(() =>
                    {
                        object throwawayobj = en.Current;
                    }
            );

            // Boundary for MoveNext: call MoveNext to make sure it returns false
            Assert.False((en.MoveNext()) || (j != 100));
            // call again MoveNext to make sure it still returns false
            Assert.False(en.MoveNext());
            Assert.Equal(100, sl2.Count);

            // now modify the sortedlist while enumerator is still active
            en = (IEnumerator)sl2.GetKeyList().GetEnumerator(); //can remove an item thru en
            en.MoveNext();

            sl2[1] = 0;  // Set (int index, object val) // this works fine

            // Boundary for MoveNext
            Assert.Throws<InvalidOperationException>(() =>
                {
                    en.MoveNext();
                });
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:101,代码来源:GetValueListTests.cs

示例9: TestGetKeyListBasic

        public void TestGetKeyListBasic()
        {
            StringBuilder sblMsg = new StringBuilder(99);
            //

            SortedList sl2 = null;
            IEnumerator en = null;

            StringBuilder sbl3 = new StringBuilder(99);
            StringBuilder sbl4 = new StringBuilder(99);
            StringBuilder sblWork1 = new StringBuilder(99);

            int i3 = 0;
            int i = 0;
            int j = 0;

            //
            // 	Constructor: Create SortedList using this as IComparer and default settings.
            //
            sl2 = new SortedList(); //using default IComparable implementation from Integer4
            // which is used here as key-val elements.

            //  Verify that the SortedList is not null.
            Assert.NotNull(sl2);

            //  Verify that the SortedList is empty.
            Assert.Equal(0, sl2.Count);

            //   Testcase: Set - null key, ArgExc expected
            Assert.Throws<ArgumentNullException>(() =>
                {
                    sl2[null] = 0;
                });

            Assert.Equal(0, sl2.Count);

            //   Testcase: Set - null val
            sl2[(Object)100] = (Object)null;
            Assert.Equal(1, sl2.Count);

            //   Testcase: vanila Set
            sl2[(Object)100] = 1;
            Assert.Equal(1, sl2.Count);

            sl2.Clear();
            Assert.Equal(0, sl2.Count);

            //   Testcase: add key-val pairs
            for (i = 0; i < 100; i++)
            {
                sl2.Add(i + 100, i);
            }

            Assert.Equal(100, sl2.Count);

            for (i = 0; i < 100; i++)
            {
                j = i + 100;
                Assert.True(sl2.ContainsKey((int)j));
                Assert.True(sl2.ContainsValue(i));
            }

            //  testcase: GetKeyList
            //  first test the boundaries on the Remove method thru GetEnumerator implementation
            en = (IEnumerator)sl2.GetKeyList().GetEnumerator();

            //  Boundary for Current
            Assert.Throws<InvalidOperationException>(() =>
                             {
                                 Object objThrowAway = en.Current;
                             }
            );

            j = 100;
            //  go over the enumarator
            en = (IEnumerator)sl2.GetKeyList().GetEnumerator();
            while (en.MoveNext())
            {
                //  Current to see the order
                i3 = (int)en.Current;
                Assert.Equal(i3, j);

                //  Current again to see the same order
                i3 = (int)en.Current;
                Assert.Equal(i3, j);

                j++;
            }


            //  Boundary for Current
            Assert.Throws<InvalidOperationException>(() =>
                             {
                                 Object objThrowAway = en.Current;
                             }
            );

            //  Boundary for MoveNext: call MoveNext to make sure it returns false
            Assert.False((en.MoveNext()) || (j != 200));

//.........这里部分代码省略.........
开发者ID:johnhhm,项目名称:corefx,代码行数:101,代码来源:GetKeyListTests.cs

示例10: Save5000GuideAsXML


//.........这里部分代码省略.........
                        if (!showHDTV && text9.StartsWith("(HDTV) "))
                        {
                            text9 = text9.Remove(0, 7);
                        }
                        if (text9.Equals(""))
                        {
                            if (text8.Equals(""))
                            {
                                writer.WriteAttributeString("episodeTitle", null, text7);
                            }
                            else
                            {
                                if (text8.Length > 0x23)
                                {
                                    text8 = text8.Substring(0, 0x20);
                                    if (text8.LastIndexOf(" ") >= 0)
                                    {
                                        text8 = text8.Substring(0, text8.LastIndexOf(" ")) + "...";
                                    }
                                }
                                writer.WriteAttributeString("episodeTitle", null, text8);
                            }
                        }
                        else
                        {
                            writer.WriteAttributeString("episodeTitle", null, text9);
                        }
                        writer.WriteAttributeString("startTimeGMT", null, text3);
                        writer.WriteAttributeString("durationInMinutes", null, text2);
                        writer.WriteAttributeString("quality", null, quality);
                        writer.WriteAttributeString("showID", null, num9.ToString());
                        writer.WriteEndElement();
                    }
                    num2 = num8;
                }
                if (!flag)
                {
                    writer.WriteEndElement();
                }
                IList keyList = list2.GetKeyList();
                for (int k = 0; k < list2.Count; k++)
                {
                    string text11;
                    ReplayChannelGuide guide2 = (ReplayChannelGuide) list2[keyList[k]];
                    string text10 = guide2.channelTitle;
                    switch (guide2.channelType)
                    {
                        case 1:
                            text11 = "Recurring";
                            break;

                        case 2:
                            text11 = "Theme";
                            break;

                        case 3:
                            text11 = "Single";
                            break;

                        case 4:
                            text11 = "Zone";
                            break;

                        default:
                            text11 = "";
                            break;
                    }
                    int num18 = guide2.channelCategory;
                    string text12 = guide2.channelCatName;
                    if (!guide2.channelDone)
                    {
                        writer.WriteStartElement("channel");
                        writer.WriteAttributeString("title", null, text10);
                        writer.WriteAttributeString("channelID", null, keyList[k].ToString());
                        writer.WriteAttributeString("channelType", null, text11);
                        writer.WriteAttributeString("categoryID", null, num18.ToString());
                        writer.WriteAttributeString("categoryName", null, text12);
                        writer.WriteEndElement();
                    }
                }
                writer.WriteEndElement();
                writer.WriteEndElement();
            }
            catch (Exception exception)
            {
                ReplayLogger.Log("Save5000GuideAsXML Exception" + exception.ToString());
                if (!flag)
                {
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
                writer.WriteEndElement();
                writer.Flush();
                writer.Close();
                return -1;
            }
            writer.Flush();
            writer.Close();
            return 1;
        }
开发者ID:BGCX261,项目名称:zoggr-svn-to-git,代码行数:101,代码来源:ReplayGuide.cs

示例11: LoadRenderedNamespaces

 internal void LoadRenderedNamespaces(SortedList nsRenderedList) {
     foreach (object attr in nsRenderedList.GetKeyList()) {
         AddRendered((XmlAttribute) attr);
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:C14NUtil.cs

示例12: DisplayStudentClassCheckedListBox

 /// <summary>
 /// Uses the yearByStudentSL sorted list of years with array of all students within that year. Will display all the Year keys as items in the CheckedListBox
 /// </summary>
 /// <param name="slIn"></param>
 private void DisplayStudentClassCheckedListBox(SortedList slIn)
 {
     //clear the existing values
     this.checkedListBox1.Items.Clear();
     //IList values = slIn.GetValueList();
     ICollection keys = slIn.GetKeyList();
     foreach (string s in keys)
     {
         this.checkedListBox1.Items.Add(s);
     }
 }
开发者ID:mcdonald1212,项目名称:ServerUtility,代码行数:15,代码来源:ServerUserCleanup.cs

示例13: GetInterfacesInNamespace

        private StringCollection GetInterfacesInNamespace(string ANamespace, SortedList AInterfaceNames)
        {
            // get all the interfaces in the current namespace
            StringCollection InterfacesInNamespace = new StringCollection();

            foreach (String InterfaceName in AInterfaceNames.GetKeyList())
            {
                // see if the class that is implementing the interface is in the current namespace (considering the difference of Shared and Server)
                if ((AInterfaceNames[InterfaceName].ToString().Substring(0,
                         AInterfaceNames[InterfaceName].ToString().LastIndexOf(".")).Replace("Instantiator.", "")
                     == ANamespace.Replace("Ict.Petra.Shared.Interfaces", "Ict.Petra.Server"))

                    /*&& (InterfaceName != "I" + ANamespace + "Namespace")*/)
                {
                    InterfacesInNamespace.Add(InterfaceName);
                }
            }

            return InterfacesInNamespace;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:20,代码来源:CreateInterfaces.cs

示例14: WriteHash

 public void WriteHash(HashAlgorithm hash, DocPosition docPos, AncestralNamespaceContextManager anc)
 {
     byte[] bytes;
     Hashtable nsLocallyDeclared = new Hashtable();
     SortedList nsListToRender = new SortedList(new NamespaceSortOrder());
     SortedList attrListToRender = new SortedList(new AttributeSortOrder());
     UTF8Encoding encoding = new UTF8Encoding(false);
     XmlAttributeCollection attributes = this.Attributes;
     if (attributes != null)
     {
         foreach (XmlAttribute attribute in attributes)
         {
             if ((((CanonicalXmlAttribute) attribute).IsInNodeSet || System.Security.Cryptography.Xml.Utils.IsNamespaceNode(attribute)) || System.Security.Cryptography.Xml.Utils.IsXmlNamespaceNode(attribute))
             {
                 if (System.Security.Cryptography.Xml.Utils.IsNamespaceNode(attribute))
                 {
                     anc.TrackNamespaceNode(attribute, nsListToRender, nsLocallyDeclared);
                 }
                 else if (System.Security.Cryptography.Xml.Utils.IsXmlNamespaceNode(attribute))
                 {
                     anc.TrackXmlNamespaceNode(attribute, nsListToRender, attrListToRender, nsLocallyDeclared);
                 }
                 else if (this.IsInNodeSet)
                 {
                     attrListToRender.Add(attribute, null);
                 }
             }
         }
     }
     if (!System.Security.Cryptography.Xml.Utils.IsCommittedNamespace(this, this.Prefix, this.NamespaceURI))
     {
         string name = (this.Prefix.Length > 0) ? ("xmlns:" + this.Prefix) : "xmlns";
         XmlAttribute attr = this.OwnerDocument.CreateAttribute(name);
         attr.Value = this.NamespaceURI;
         anc.TrackNamespaceNode(attr, nsListToRender, nsLocallyDeclared);
     }
     if (this.IsInNodeSet)
     {
         anc.GetNamespacesToRender(this, attrListToRender, nsListToRender, nsLocallyDeclared);
         bytes = encoding.GetBytes("<" + this.Name);
         hash.TransformBlock(bytes, 0, bytes.Length, bytes, 0);
         foreach (object obj2 in nsListToRender.GetKeyList())
         {
             (obj2 as CanonicalXmlAttribute).WriteHash(hash, docPos, anc);
         }
         foreach (object obj3 in attrListToRender.GetKeyList())
         {
             (obj3 as CanonicalXmlAttribute).WriteHash(hash, docPos, anc);
         }
         bytes = encoding.GetBytes(">");
         hash.TransformBlock(bytes, 0, bytes.Length, bytes, 0);
     }
     anc.EnterElementContext();
     anc.LoadUnrenderedNamespaces(nsLocallyDeclared);
     anc.LoadRenderedNamespaces(nsListToRender);
     foreach (XmlNode node in this.ChildNodes)
     {
         CanonicalizationDispatcher.WriteHash(node, hash, docPos, anc);
     }
     anc.ExitElementContext();
     if (this.IsInNodeSet)
     {
         bytes = encoding.GetBytes("</" + this.Name + ">");
         hash.TransformBlock(bytes, 0, bytes.Length, bytes, 0);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:66,代码来源:CanonicalXmlElement.cs

示例15: GatherNamespaceToRender

        private void GatherNamespaceToRender(string nsPrefix, SortedList nsListToRender, Hashtable nsLocallyDeclared) {
            foreach (object a in nsListToRender.GetKeyList()) {
                if (Utils.HasNamespacePrefix((XmlAttribute) a, nsPrefix))
                    return;
            }

            int rDepth;
            XmlAttribute local = (XmlAttribute) nsLocallyDeclared[nsPrefix];
            XmlAttribute rAncestral = GetNearestRenderedNamespaceWithMatchingPrefix(nsPrefix, out rDepth);

            if (local != null) {
                if (Utils.IsNonRedundantNamespaceDecl(local, rAncestral)) {
                    nsLocallyDeclared.Remove(nsPrefix);
                    nsListToRender.Add(local, null);
                }
            } else {
                int uDepth;
                XmlAttribute uAncestral = GetNearestUnrenderedNamespaceWithMatchingPrefix(nsPrefix, out uDepth);
                if (uAncestral != null && uDepth > rDepth && Utils.IsNonRedundantNamespaceDecl(uAncestral, rAncestral)) {
                    nsListToRender.Add(uAncestral, null);
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:23,代码来源:ExcCanonicalXml.cs


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