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


C# SortedList.GetEnumerator方法代码示例

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


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

示例1: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentType = "text/xml";
            int pageId;

            XmlNode root = _xd.CreateElement("tasks");

            if (int.TryParse(Request["id"], out pageId))
            {
                var t = new Task(pageId);
                if (t.User.Id == base.getUser().Id || t.ParentUser.Id == base.getUser().Id)
                {
                    XmlNode x = CreateTaskNode(t, _xd);
                    root.AppendChild(x);

                    xmlContents.Text = root.OuterXml;

                    Response.AddHeader("Content-Disposition", "attachment; filename=" + t.Node.Text.Replace(" ", "_") + ".xml");
                }
            }
            else
            {
                var nodes = new SortedList();
                int totalWords = 0;

                foreach (Task t in Task.GetTasks(base.getUser(), false))
                {
                    if (!nodes.ContainsKey(t.Node.Path))
                    {
                        var xTask = CreateTaskNode(t, _xd);
                        totalWords += int.Parse(xTask.Attributes.GetNamedItem("TotalWords").Value);
                        nodes.Add(t.Node.Path, xTask);
                    }
                }

                // Arrange nodes in tree
                var ide = nodes.GetEnumerator();
                while (ide.MoveNext())
                {
                    var x = (XmlElement)ide.Value;
                    var parentXpath = UmbracoSettings.UseLegacyXmlSchema ? "//node [@id = '" + x.SelectSingleNode("//node").Attributes.GetNamedItem("parentID").Value + "']" :
                        "//* [@isDoc and @id = '" + x.SelectSingleNode("//* [@isDoc]").Attributes.GetNamedItem("parentID").Value + "']";
                    var parent = _xd.SelectSingleNode(parentXpath);

                    if (parent == null)
                        parent = root;
                    else
                        parent = parent.ParentNode;

                    parent.AppendChild((XmlElement)ide.Value);
                }

                root.Attributes.Append(XmlHelper.AddAttribute(_xd, "TotalWords", totalWords.ToString()));
                xmlContents.Text = root.OuterXml;
                Response.AddHeader("Content-Disposition", "attachment; filename=all.xml");

            }
        }
开发者ID:saciervo,项目名称:Umbraco-CMS,代码行数:58,代码来源:xml.aspx.cs

示例2: Page_Load

        protected void Page_Load(object sender, System.EventArgs e)
        {
            pp_name.Text = ui.Text("name");
            pp_renderControl.Text = ui.Text("renderControl");
            pane_settings.Text = ui.Text("settings");
            pp_guid.Text = ui.Text("guid");


            _id = int.Parse(Request.QueryString["id"]);
            dt = cms.businesslogic.datatype.DataTypeDefinition.GetDataTypeDefinition(_id);


            f = new cms.businesslogic.datatype.controls.Factory();

            if (!IsPostBack)
            {
                txtName.Text = dt.Text;

                SortedList datatypes = new SortedList();

                foreach (interfaces.IDataType df in f.GetAll())
                    datatypes.Add(df.DataTypeName + "|" + Guid.NewGuid().ToString(), df.Id);

                IDictionaryEnumerator ide = datatypes.GetEnumerator();

                string datatTypeId = dt.DataType != null ? dt.DataType.Id.ToString() : String.Empty;
                while (ide.MoveNext())
                {
                    ListItem li = new ListItem();
                    li.Text = ide.Key.ToString().Substring(0, ide.Key.ToString().IndexOf("|"));
                    li.Value = ide.Value.ToString();

                    //SJ Fixes U4-2488 Edit datatype: Media Picker appears incorrectly
                    //Apparently in some installs the media picker rendercontrol is installed twice with 
                    //the exact same ID so we need to check for duplicates
                    if (ddlRenderControl.Items.Contains(li))
                        continue;

                    if (!String.IsNullOrEmpty(datatTypeId) && li.Value.ToString() == datatTypeId) li.Selected = true;
                    ddlRenderControl.Items.Add(li);
                }

                ClientTools
                    .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadDataTypes>().Tree.Alias)
                    .SyncTree("-1,init," + _id.ToString(), false);

            }

            if (dt.DataType != null)
                litGuid.Text = dt.DataType.Id.ToString();
            Panel1.Text = umbraco.ui.Text("edit") + " datatype: " + dt.Text;
            insertPrevalueEditor();
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:53,代码来源:editDatatype.aspx.cs

示例3: queryTrans

 public string queryTrans(SortedList trans, bool text)
 {
     string query = "";
     IDictionaryEnumerator en = trans.GetEnumerator();
     en.Reset();
     while (en.MoveNext())
     {
         query += ((Translation) en.Value).Title;
         if (text) query += " " + ((Translation) en.Value).Text;
     }
     return query;
 }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:12,代码来源:Search.cs

示例4: PatientAssociateArray

 public PatientAssociateArray(SortedList lst)
 {
     if (lst == null || lst.Count == 0)
     {
         count = 0;
         return;
     }
     pas = new PatientAssociateTO[lst.Count];
     IDictionaryEnumerator e = lst.GetEnumerator();
     int i = 0;
     while (e.MoveNext())
     {
         pas[i++] = new PatientAssociateTO((PatientAssociate)e.Value);
     }
     count = lst.Count;
 }
开发者ID:OSEHRA,项目名称:mdws,代码行数:16,代码来源:PatientAssociateArray.cs

示例5: PersonArray

 public PersonArray(SortedList lst)
 {
     if (lst == null || lst.Count == 0)
     {
         count = 0;
         return;
     }
     persons = new PersonTO[lst.Count];
     IDictionaryEnumerator e = lst.GetEnumerator();
     int i = 0;
     while (e.MoveNext())
     {
         persons[i++] = new PersonTO((Person)e.Value);
     }
     count = lst.Count;
 }
开发者ID:ChristopherEdwards,项目名称:MDWS,代码行数:16,代码来源:PersonArray.cs

示例6: CityArray

 public CityArray(SortedList lst)
 {
     if (lst == null || lst.Count == 0)
     {
         count = 0;
         return;
     }
     cities = new CityTO[lst.Count];
     IDictionaryEnumerator e = lst.GetEnumerator();
     int i = 0;
     while (e.MoveNext())
     {
         cities[i++] = new CityTO((City)e.Value);
     }
     count = lst.Count;
 }
开发者ID:OSEHRA,项目名称:mdws,代码行数:16,代码来源:CityArray.cs

示例7: updateCultureList

		private void updateCultureList() 
		{
            SortedList sortedCultures = new SortedList();
            Cultures.Items.Clear();
            Cultures.Items.Add(new ListItem(ui.Text("choose") + "...", ""));
            foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures))
                sortedCultures.Add(ci.DisplayName + "|||" + Guid.NewGuid().ToString(), ci.Name);

            IDictionaryEnumerator ide = sortedCultures.GetEnumerator();
            while (ide.MoveNext())
            {
                ListItem li = new ListItem(ide.Key.ToString().Substring(0, ide.Key.ToString().IndexOf("|||")), ide.Value.ToString());
                if (ide.Value.ToString() == currentLanguage.CultureAlias)
                    li.Selected = true;

                Cultures.Items.Add(li);
            }
        }
开发者ID:elrute,项目名称:Triphulcas,代码行数:18,代码来源:editLanguage.aspx.cs

示例8: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            // get all existing languages

            sbmt.Text = ui.Text("create");
            SortedList sortedCultures = new SortedList();
            Cultures.Items.Clear();
            Cultures.Items.Add(new ListItem(ui.Text("choose") + "...", ""));
            foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures))
            {
                    sortedCultures.Add(ci.DisplayName + "|||" + Guid.NewGuid().ToString(), ci.Name);
            }

            IDictionaryEnumerator ide = sortedCultures.GetEnumerator();
            while (ide.MoveNext())
            {
                ListItem li = new ListItem(ide.Key.ToString().Substring(0, ide.Key.ToString().IndexOf("|||")), ide.Value.ToString());
                Cultures.Items.Add(li);
            }
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:20,代码来源:language.ascx.cs

示例9: SiteArray

 public SiteArray(SortedList lst)
 {
     if (lst == null || lst.Count == 0)
     {
         count = 0;
         return;
     }
     ArrayList al = new ArrayList(lst.Count);
     IDictionaryEnumerator e = lst.GetEnumerator();
     while (e.MoveNext())
     {
         Site s = (Site)e.Value;
         if (s != null)
         {
             al.Add(new SiteTO(s));
         }
     }
     sites = (SiteTO[])al.ToArray(typeof(SiteTO));
     count = sites.Length;
 }
开发者ID:OSEHRA,项目名称:mdws,代码行数:20,代码来源:SiteArray.cs

示例10: Simple

        public void Simple()
        {
            var sortedList = new SortedList<int>();

            for (var i = 0; i < 20; i++)
            {
                sortedList.Add(i);
            }

            var counter = 0;
            var enumerator = sortedList.GetEnumerator();

            while (enumerator.MoveNext())
            {
                Assert.AreEqual(enumerator.Current, counter);
                counter++;
            }

            Assert.AreEqual(counter, 20);
        }
开发者ID:GTuritto,项目名称:ngenerics,代码行数:20,代码来源:GetEnumerator.cs

示例11: SearchCollection

        public bool SearchCollection(string query, SortedList list, ListBox resultBox,
            bool text, bool matchCase, bool whole, bool trans)
        {
            long start = Util.getCurrentTicks();
            IDictionaryEnumerator en = list.GetEnumerator();
            en.Reset();
            string target = "";
            Song song;
            bool found = false;
            while (en.MoveNext())
            {
                song = (Song) en.Value;

                // only title?
                target = text ? (song.Title + " " + song.Text) : song.Title;

                // with translations?
                if (trans)
                {
                    target += (" " + song.queryTrans(this, text));
                }

                // if case doesn't need to be matched, make all letters small ones...
                if (!matchCase)
                {
                    target = target.ToLower();
                    query = query.ToLower();
                }

                if (this.Or(query, this.cleanTarget(target), whole))
                {
                    resultBox.Items.Add(song);
                    found = true;
                }
            }
            Util.addSearchTime(Util.getCurrentTicks() - start);
            return found;
        }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:38,代码来源:Search.cs

示例12: GetAll

        /// <summary>
        /// Retrieves a list of all datatypedefinitions
        /// </summary>
        /// <returns>A list of all datatypedefinitions</returns>
        public static DataTypeDefinition[] GetAll()
        {
            SortedList retvalSort = new SortedList();
            Guid[] tmp = CMSNode.getAllUniquesFromObjectType(_objectType);
            DataTypeDefinition[] retval = new DataTypeDefinition[tmp.Length];
            for (int i = 0; i < tmp.Length; i++)
            {
                DataTypeDefinition dt = DataTypeDefinition.GetDataTypeDefinition(tmp[i]);
                retvalSort.Add(dt.Text + "|||" + Guid.NewGuid().ToString(), dt);
            }

            IDictionaryEnumerator ide = retvalSort.GetEnumerator();
            int counter = 0;
            while (ide.MoveNext())
            {
                retval[counter] = (DataTypeDefinition)ide.Value;
                counter++;
            }
            return retval;
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:24,代码来源:DataTypeDefinition.cs

示例13: BuildComplexTypeParser

 public static void BuildComplexTypeParser(Hashtable SequenceTable, Hashtable ChoiceTable, CodeProcessor cs, SortedList SortedServiceList, string pc_methodPrefix, string pc_methodLibPrefix)
 {
     IDictionaryEnumerator en = SortedServiceList.GetEnumerator();
     while (en.MoveNext())
     {
         UPnPService service = (UPnPService)en.Value;
         foreach (UPnPComplexType CT in service.GetComplexTypeList())
         {
             int SeqX = 0;
             int ChoX = 0;
             cs.Append("struct " + CT.Name_LOCAL + "* " + pc_methodPrefix + "Parse_" + CT.Name_LOCAL + "(struct " + pc_methodLibPrefix + "XMLNode *node)" + cl);
             cs.Append("{" + cl);
             cs.Append("	struct " + pc_methodLibPrefix + "XMLNode *current = node;" + cl);
             cs.Append("	struct " + CT.Name_LOCAL + " *RetVal;" + cl);
             cs.Append("	" + cl);
             cs.Append("	int OK;" + cl);
             cs.Append("	char *text;" + cl);
             cs.Append("	int textLength;" + cl);
             cs.Append("	if ((RetVal = (struct " + CT.Name_LOCAL + "*)malloc(sizeof(struct " + CT.Name_LOCAL + "))) == NULL) ILIBCRITICALEXIT(254);" + cl);
             cs.Append(cl);
             cs.Append("	memset(RetVal, 0, sizeof(struct " + CT.Name_LOCAL + "));" + cl);
             cs.Append(cl);
             cs.Append("	while(node != NULL)" + cl);
             cs.Append("	{" + cl);
             cs.Append("		textLength = " + pc_methodLibPrefix + "ReadInnerXML(node, &text);" + cl);
             foreach (UPnPComplexType.GenericContainer gc in CT.Containers)
             {
                 foreach (UPnPComplexType.ItemCollection ic in gc.Collections)
                 {
                     BuildComplexTypeParser_Collection("", SequenceTable, ChoiceTable, ref SeqX, ref ChoX, cs, ic, pc_methodPrefix);
                 }
             }
             cs.Append("	node = node->Peer;" + cl);
             cs.Append("	}" + cl);
             cs.Append("	return(RetVal);" + cl);
             cs.Append("}" + cl);
         }
     }
 }
开发者ID:evolution124,项目名称:Developer-Tools-for-UPnP-Technologies,代码行数:39,代码来源:EmbeddedCGenerator.cs

示例14: getSelectedItemsFromMediaItemList

 protected List<MediaItem> getSelectedItemsFromMediaItemList(ListBox _listView)
 {
     Object trackInfo;
     MediaItem mediaItem;
     IEnumerator selectedItemsEnum = _listView.SelectedItems.GetEnumerator();
     List<MediaItem> list = new List<MediaItem>();
     SortedList<int, MediaItem> listSorted = new SortedList<int, MediaItem>();
     while (selectedItemsEnum.MoveNext())
     {
         trackInfo = selectedItemsEnum.Current;
         mediaItem = (MediaItem)trackInfo;
         listSorted.Add(mediaItem.listIndex, mediaItem);
     }
     selectedItemsEnum = listSorted.GetEnumerator();
     foreach (var pair in listSorted)
     {
         mediaItem = (MediaItem)pair.Value;
         list.Add(mediaItem);
     }
     return list;
 }
开发者ID:stoennies,项目名称:raumwiese,代码行数:21,代码来源:MainWindow_ListViewMain.cs

示例15: LoadFunctionSets

 private void LoadFunctionSets(int FileVer)
 {
     string left = Main.pvStr(FileVer, ".");
     cfgFile cfgFile = new cfgFile(Main.AppPath() + "Config\\FunctionSets.cfg");
     SortedList sortedList = new SortedList();
     Regex regex = new Regex("^\\d{2}\\.\\d{2}\\.\\d{2}\\.\\d{2}$");
     cfgFile.cfgSection[] sections = cfgFile.Sections;
     checked
     {
         for (int i = 0; i < sections.Length; i++)
         {
             cfgFile.cfgSection cfgSection = sections[i];
             bool flag = regex.Match(cfgSection.Name).Success;
             if (flag)
             {
                 sortedList.Add(cfgSection.Name, cfgSection);
             }
         }
         IDictionaryEnumerator enumerator = sortedList.GetEnumerator();
         while (enumerator.MoveNext())
         {
             object expr_98 = enumerator.Current;
             DictionaryEntry dictionaryEntry2;
             DictionaryEntry dictionaryEntry = (expr_98 != null) ? ((DictionaryEntry)expr_98) : dictionaryEntry2;
             bool flag = Operators.ConditionalCompareObjectLess(left, dictionaryEntry.Key, false);
             if (!flag)
             {
                 cfgFile.cfgSection cfgSection2 = (cfgFile.cfgSection)dictionaryEntry.Value;
                 cfgFile.cfgKey[] keys = cfgSection2.Keys;
                 for (int j = 0; j < keys.Length; j++)
                 {
                     cfgFile.cfgKey cfgKey = keys[j];
                     flag = this.FunctionSets.ContainsKey(cfgKey.Name);
                     if (flag)
                     {
                         this.FunctionSets[cfgKey.Name] = cfgKey.Value;
                     }
                     else
                     {
                         this.FunctionSets.Add(cfgKey.Name, cfgKey.Value);
                     }
                 }
             }
         }
     }
 }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:46,代码来源:Parser.cs


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