本文整理汇总了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<KeyValuePair<System.String, System.String>>.</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();
}
示例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;
}
}