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


C# Queue.ToList方法代码示例

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


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

示例1: GetPage

        public IEnumerable<Moneta> GetPage(string page)
        {
            var qq = new Queue<Moneta>();
            var pagenum = 0;
            int.TryParse(page, out pagenum);
            var html = Helper.GetHtmlAsync(Constant.GetParentUrl(pagenum));
            var table = Helper.GetSingleTag(html.Result, "table", "class", "adsmanager_table");

            if (table != null)
                foreach (var tr in table.Descendants("tr"))
                {

                    var tdAdsmanager = Helper.GetSingleNodeTag(tr, "td", "class", "adsmanager_table_description");
                    var tdCenter = Helper.GetSingleNodeTag(tr, "td", "class", "center");

                    if (tdAdsmanager != null && tdCenter != null)
                    {
                        var regexCreateIn = Regex.Match(tdCenter.InnerHtml, Constant.RegexCreateDate,
                            RegexOptions.IgnoreCase | RegexOptions.Compiled);
                        var regexCount = Regex.Match(tdCenter.InnerHtml, Constant.RegexViewsCount,
                            RegexOptions.IgnoreCase | RegexOptions.Compiled);
                        var regexId = Regex.Match(tdAdsmanager.InnerHtml, Constant.RegexGetItemId,
                            RegexOptions.IgnoreCase | RegexOptions.Compiled);
                        var regexCatId = Regex.Match(tdAdsmanager.InnerHtml, Constant.RegexGetItemCatId,
                            RegexOptions.IgnoreCase | RegexOptions.Compiled);

                        if (!regexId.Success || !regexCatId.Success || !regexCreateIn.Success || !regexCount.Success)
                            continue;

                        var id = int.Parse(regexId.Groups[1].Value);
                        var catId = int.Parse(regexCatId.Groups[1].Value);
                        var date = DateTime.ParseExact(regexCreateIn.Value, "dd.MM.yyyy",CultureInfo.InvariantCulture);
                        var countViews = Helper.IntParce(regexCount.Groups[1].Value);
                        qq.Enqueue(GetItem(catId, id, date, countViews));
                    }
                }

            return qq.ToList();
        }
开发者ID:neomichi,项目名称:TestWork,代码行数:39,代码来源:ParserService.svc.cs

示例2: MakeTableAndTree

        public void MakeTableAndTree()
        {
			Queue<Symbol> currentQueue = new Queue<Symbol>();
            Ensemble.OrderBy(o => o.Frequency).ToList().ForEach(p => currentQueue.Enqueue(p));
            ProbabilityTable.Add(currentQueue.ToList());
            while (currentQueue.Count > 1)
            {
                var newNode = new Symbol(currentQueue.Dequeue(), currentQueue.Dequeue());
                var temporaryQueue = currentQueue.ToList();
                if (currentQueue.Count == 0)
                {
                    currentQueue.Enqueue(newNode);
                }
                else
                {
                    int index = 0;
                    currentQueue.ToList().ForEach(p =>
                    {
                        if (newNode.Frequency <= p.Frequency)
                        {
                            index = currentQueue.ToList().IndexOf(p);
                        }
                        else
                        {
                            index++;
                        }
                    });
                    temporaryQueue.Insert(index, newNode);
                    currentQueue.Clear();
                    temporaryQueue.ForEach(p => currentQueue.Enqueue(p));
                }
                ProbabilityTable.Add(currentQueue.ToList());
            }
        }
开发者ID:kirillbeldyaga,项目名称:Huffman-Code-Coder-and-Decoder,代码行数:34,代码来源:Huffman.cs


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