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


C# SortedDictionary.AsEnumerable方法代码示例

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


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

示例1: DeleteFiles

        /// <summary>
        /// Deletes the files.
        /// </summary>
        /// <param name="files">The files.</param>
        /// <returns>IEnumerable&lt;KeyValuePair&lt;System.String, System.String&gt;&gt;.</returns>
        public static IEnumerable<KeyValuePair<string, string>> DeleteFiles(this IEnumerable<string> files)
        {
            var errors = new SortedDictionary<string, string>();

            foreach (var information in files.AsParallel())
            {
                try
                {
                    File.Delete(information);
                }
                catch (IOException fileIOException)
                {
                    errors.AddIfNotExists(new KeyValuePair<string, string>(information, fileIOException.Message));
                }
                catch (UnauthorizedAccessException notAuthorizedException)
                {
                    errors.AddIfNotExists(new KeyValuePair<string, string>(information, notAuthorizedException.Message));
                }
            }
            return errors.AsEnumerable();
        }
开发者ID:RealDotNetDave,项目名称:dotNetTips.Utility,代码行数:26,代码来源:FileHelper.cs

示例2: AggregateBasisRisk


//.........这里部分代码省略.........

                        #region BuildRow

                        // Create entry if doesn't exist
                        var sb = new SeriesBuilder<string, object>();
                        string addOn = bLiveOrEOD ? "" : "EOD";
                        sb.Add("CountryOfRisk" + addOn, row.TryGet("CountryOfRisk").ValueOrDefault);
                        if (bInclSnED) sb.Add("Product Type" + addOn, row.TryGet("ProductType").ValueOrDefault);
                        sb.Add("BondMaturity" + addOn, bondMaturity);
                        sb.Add("Description" + addOn, instrument);
                        sb.Add("ISIN" + addOn, row.TryGet("ISIN").ValueOrDefault);
                        sb.Add("Bond DV01" + addOn, bond01);
                        sb.Add("Fut DV01" + addOn, fut01);
                        if (bInclSnED)
                        {
                            sb.Add("Swap DV01" + addOn, swap01);
                            sb.Add("Interest Future DV01" + addOn, ED01);
                        }
                        sb.Add("Total DV01" + addOn, totalDV01);
                        sb.Add("Bond BalanceSheet" + addOn, balancesheet);
                        sb.Add("Fut Notional" + addOn, futNotional);
                        if (bInclSnED)
                        {
                            sb.Add("Swap Notional" + addOn, swapNotional);
                            sb.Add("Interest Future Notional" + addOn, EDNotional);
                        }
                        sb.Add("Total Notional" + addOn, totalNotional);
                        sb.Add("MLP Allocation" + addOn, MLPAlloc);
                        sb.Add("FM-1" + addOn, prevfront);
                        sb.Add("FM1" + addOn, front);
                        sb.Add("BM1" + addOn, back);
                        sb.Add("BM2" + addOn, back2);

                        uniqueRows[bondMaturity.ToShortDateString() + "_" + instrument] = sb.Series;

                        #endregion
                    }
                }

                #endregion

                // Package outputs
                string appendix = bLiveOrEOD ? "" : "EOD";
                aggregateFrame = Frame.FromRows(uniqueRows.AsEnumerable());
                aggregateFrame = FrameExtensions.SortRows(aggregateFrame, "BondMaturity" + appendix);

                var output = MainHelpers.getFrameAsObjArr(aggregateFrame, sortkeys: false);
                output[0, 0] = "ID";
                return output;
            }
            catch (Exception ex)
            {
                SLog.log.ErrorFormat("Error in SymAggregateBasisRiskReportData(): {0}", ex.Message);

                // RETURN HEADERS, to avoid messing pivot charts up
                // Create entry if doesn't exist

                var sb = new SeriesBuilder<string, object>();
                string addOn = bLiveOrEOD ? "" : "EOD";
                sb.Add("CountryOfRisk" + addOn, "#Error");
                sb.Add("BondMaturity" + addOn, "#Error");
                sb.Add("Description" + addOn, "#Error");
                sb.Add("ISIN" + addOn, "#Error");
                sb.Add("Bond DV01" + addOn, "#Error");
                sb.Add("Fut DV01" + addOn, "#Error");
                if (bInclSnED)
                {
                    sb.Add("Swap DV01" + addOn, "#Error");
                    sb.Add("Interest Future DV01" + addOn, "Error");
                }
                sb.Add("Total DV01" + addOn, "#Error");
                sb.Add("Bond BalanceSheet" + addOn, "#Error");
                sb.Add("Fut Notional" + addOn, "#Error");
                if (bInclSnED)
                {
                    sb.Add("Swap Notional" + addOn, "#Error");
                    sb.Add("Interest Future Notional" + addOn, "#Error");
                }
                sb.Add("Total Notional" + addOn, "#Error");
                sb.Add("MLP Allocation" + addOn, "#Error");
                sb.Add("FM-1" + addOn, "#Error");
                sb.Add("FM1" + addOn, "#Error");
                sb.Add("BM1" + addOn, "#Error");
                sb.Add("BM2" + addOn, "#Error");

                SortedDictionary<string, Series<string, object>>
                    uniqueRows = new SortedDictionary<string, Series<string, object>>();

                uniqueRows["Error"] = sb.Series;


                string appendix = bLiveOrEOD ? "" : "EOD";
                Frame<string, string> aggregateFrame = Frame.FromRows(uniqueRows.AsEnumerable());
                aggregateFrame = FrameExtensions.SortRows(aggregateFrame, "BondMaturity" + appendix);

                var output = MainHelpers.getFrameAsObjArr(aggregateFrame, sortkeys: false);
                output[0, 0] = "ID";
                return output;
            }
        }
开发者ID:heimanhon,项目名称:researchwork,代码行数:101,代码来源:SymExcelUtil.cs


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