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


C# SortedDictionary.ToDictionary方法代码示例

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


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

示例1: calcFwdBondMeasure

        //------------------------------------------------------------------------------------------------
        public static double calcFwdBondMeasure(string measure,
            AnalyticsBondStaticData bondstatic,
            double fwdPrice,
            DateTime asofDate, DateTime settle,
            SpreadConventions convs,
            SortedDictionary<DateTime, Tuple<DateTime,double>[]> ForecastCurves,
            SortedDictionary<DateTime, Tuple<DateTime, double>[]> DiscountCurves,
            List<DateTime> hols,
            Tuple<DateTime, double> previous = null)
            //------------------------------------------------------------------------------------------------
        {

            // Cast forecast and discount curves
            var newForecastCurves = new SortedDictionary<DateTime, DiscountFactors>(
                ForecastCurves.ToDictionary(kvp => kvp.Key, kvp => new DiscountFactors(kvp.Value)));
            var newDiscountCurves = new SortedDictionary<DateTime, DiscountFactors>(
                DiscountCurves.ToDictionary(kvp => kvp.Key, kvp => new DiscountFactors(kvp.Value)));

            // Run them through original code
            return calcFwdBondMeasure(measure,bondstatic,fwdPrice,asofDate,settle,convs,newForecastCurves,newDiscountCurves,hols,previous);

        }
开发者ID:heimanhon,项目名称:researchwork,代码行数:23,代码来源:MeasureCalculator.cs

示例2: GetFacets

        public Dictionary<string, string> GetFacets(string searchTerm, out string totalCount)
        {
            Dictionary<string, string> facetsDict = new Dictionary<string, string>();

            List<FacetCategory> Facets = SearchProvider.GetFacets(searchTerm, "site_section_facet", out totalCount);
            var FacetList = GetFacetsList();
            if (FacetList != null)
            {
                facetsDict = new Dictionary<string, string>(FacetList.ToDictionary(x => x.ID.ToShortID().ToString().ToLower(), x => string.Format("{0}|(0)", x["title"])));
            }

            if (Facets != null && Facets.Count > 0)
            {
                //facet.name returns a shortid so get the name from sitecore item
                foreach (var category in Facets)
                {
                    foreach (var facet in category.Values.OrderByDescending(i => i.AggregateCount))
                    {
                        if (facetsDict.ContainsKey(facet.Name))
                        {
                            facetsDict[facet.Name] = facetsDict[facet.Name].Replace("0", facet.AggregateCount.ToString());
                        }
                    }
                }
            }
            //SortedDictionary so that sorting is done based on Facet Name chronologically

            SortedDictionary<string, string> retDict = new SortedDictionary<string, string>(facetsDict.ToDictionary(x => x.Value.Split('|')[0], x => x.Value));
            return retDict.ToDictionary(x => x.Key, x => x.Value);
        }
开发者ID:brijbaroda,项目名称:HabSearch,代码行数:30,代码来源:AdvanceSearchController.cs

示例3: UpdateAnalysisTree

        private static void UpdateAnalysisTree(IPythonProjectEntry pyEntry, SortedDictionary<int, ParseResult> parseResults) {
            IAnalysisCookie cookie = new VersionCookie(
                parseResults.ToDictionary(
                    x => x.Key,
                    x => new BufferVersion(x.Value.Version, x.Value.Ast)
                )
            );

            var asts = parseResults.Where(x => x.Value.Ast != null).Select(x => x.Value.Ast).ToArray();
            PythonAst finalAst;
            if (asts.Length == 1) {
                finalAst = asts[0];
            } else if (asts.Length > 0) {
                // multiple ASTs, merge them together
                finalAst = new PythonAst(
                    new SuiteStatement(
                        asts.Select(ast => ast.Body).ToArray()
                    ),
                    new NewLineLocation[0],
                    asts[0].LanguageVersion
                );
            } else {
                // we failed to get any sort of AST out, so we can't analyze...
                // But we need to balance the UpdateTree call, so just fetch the
                // last valid ast and cookie.
                pyEntry.GetTreeAndCookie(out finalAst, out cookie);
            }

            pyEntry.UpdateTree(finalAst, cookie);
        }
开发者ID:,项目名称:,代码行数:30,代码来源:

示例4: GetVideoUrl

        public override string GetVideoUrl(VideoInfo video)
        {
            string webdata = GetWebData(video.VideoUrl);
            XmlDocument doc = new XmlDocument();
            video.PlaybackOptions = new Dictionary<string, string>();

            string hoster = video.Other as string;
            switch (hoster)
            {
                case "own3d":
                    {
                        doc.LoadXml(webdata);
                        XmlNodeList streams = doc.SelectNodes("//config/channels/channel/clip/item[starts-with(@base, 'rtmp')]/stream");
                        foreach (XmlNode stream in streams)
                        {
                            string label = stream.Attributes["label"].Value;
                            RtmpUrl theUrl = new RtmpUrl(stream.ParentNode.Attributes["base"].Value)
                                {
                                    PlayPath = stream.Attributes["name"].Value,
                                    Live = true
                                };
                            if (!video.PlaybackOptions.ContainsKey(label))
                                video.PlaybackOptions.Add(label, theUrl.ToString());
                        }; break;
                    }
                case "justin":
                    {
                        string s2 = Regex.Replace(webdata, @"<((?:/)?)(\d)", "<$1a$2");
                        // fix illegal <number items
                        doc.LoadXml(s2);
                        SortedDictionary<int, string> urls = new SortedDictionary<int, string>();
                        foreach (XmlNode stream in doc.SelectSingleNode("nodes").ChildNodes)
                        {
                            string node = stream.SelectSingleNode("node").InnerText;
                            string play = stream.SelectSingleNode("play").InnerText;
                            string bitrate = stream.SelectSingleNode("bitrate").InnerText;
                            int br = Convert.ToInt32(double.Parse(bitrate));
                            string token = stream.SelectSingleNode("token").InnerText;
                            string connect = stream.SelectSingleNode("connect").InnerText;
                            RtmpUrl theUrl = new RtmpUrl(connect)
                            {
                                Jtv = token,
                                Live = true,
                                PlayPath = play,
                                SwfUrl = @"http://www-cdn.jtvnw.net/widgets/live_embed_player.r9c27c302ba389b0ff3a9f34a7a0cb495dfc3e424.swf"
                            };
                            if (!urls.ContainsKey(br))
                                urls.Add(br, theUrl.ToString());
                        }
                        video.PlaybackOptions = urls.ToDictionary(u => u.Key.ToString() + "b/s", u => u.Value);
                    }; break;
            }

            string resultUrl;
            if (video.PlaybackOptions.Count == 0) return String.Empty;
            else
                resultUrl = video.PlaybackOptions.Last().Value;
            if (video.PlaybackOptions.Count == 1) video.PlaybackOptions = null;
            return resultUrl;

        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:61,代码来源:LeagueOfLegendsUtil.cs


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