本文整理汇总了C#中ILookup.SelectMany方法的典型用法代码示例。如果您正苦于以下问题:C# ILookup.SelectMany方法的具体用法?C# ILookup.SelectMany怎么用?C# ILookup.SelectMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILookup
的用法示例。
在下文中一共展示了ILookup.SelectMany方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExpandGenericNavigationPropertyActions
private ILookup<string, HttpActionDescriptor> ExpandGenericNavigationPropertyActions(ILookup<string, HttpActionDescriptor> innerMapping)
{
List<HttpActionDescriptor> removeDescriptors = new List<HttpActionDescriptor>();
List<HttpActionDescriptor> expandedDescriptors = new List<HttpActionDescriptor>();
// Expand generic methods named "PostNavigationProperty" to all supported types
ExpandGenericNavigationActionsForAllNavigationProperties(innerMapping[GenericNavigationPropertyRoutingConvention.PostNavigationPropertyMethodName],
expandedDescriptors,
removeDescriptors,
navPropertyName => "Post" + navPropertyName);
ExpandGenericNavigationActionsForAllNavigationProperties(innerMapping[GenericNavigationPropertyRoutingConvention.GetNavigationPropertyMethodName],
expandedDescriptors,
removeDescriptors,
navPropertyName => "Get" + navPropertyName);
if (expandedDescriptors.Count == 0)
{
// No additions
return innerMapping;
}
else
{
// Combine inner action descriptors plus expanded action descriptors
return expandedDescriptors.Concat(innerMapping.SelectMany(g => g).Except(removeDescriptors))
.ToLookup(httpActionDescriptor => httpActionDescriptor.ActionName);
}
}
示例2: Create
public static RequestQueryParameters Create(ILookup<string, string> queryParams)
{
return new RequestQueryParameters(queryParams
.SelectMany(queryParam => queryParam
.Select(paramValue => new KeyValuePair<string, string>(queryParam.Key, paramValue))));
}
示例3: Format
/// <summary>
/// Formats the specified results.
/// </summary>
/// <param name="Results">The results.</param>
/// <param name="OutputDirectory">The output directory.</param>
public void Format(ILookup<ISeries, Core.Result> Results, string OutputDirectory)
{
string Result = new FileInfo("resource://Sundial.DefaultFormatter/Sundial.DefaultFormatter.Results.html").Read();
foreach (var Grouping in Results)
{
var TempResults = Grouping.OrderByDescending(x => x.Percentile(0.95m).Time);
string FiftyPercentile = GetPercentile(TempResults, 0.5m);
string SeventyFivePercentile = GetPercentile(TempResults, 0.75m);
string NintyPercentile = GetPercentile(TempResults, 0.9m);
string NintyFivePercentile = GetPercentile(TempResults, 0.95m);
string Ticks = GetTimeTicks(TempResults);
string Description = GetDescription(TempResults);
string CPUData = GetCPUData(TempResults);
string MemoryData = GetMemoryData(TempResults);
string Rows = GetTableData(TempResults);
new FileInfo(System.IO.Path.Combine(OutputDirectory, Grouping.Key.Name + "Result.html"))
.Write(string.Format(Result,
FiftyPercentile,
SeventyFivePercentile,
NintyPercentile,
NintyFivePercentile,
Ticks,
Rows,
CPUData,
MemoryData,
Description,
string.IsNullOrEmpty(Grouping.Key.Name) ? "" : (Grouping.Key.Name + " "),
DateTime.Now.ToString("MM/dd/yyyy")));
}
var OverallResults = Results.SelectMany(x => x.ToList()).OrderByDescending(x => x.Percentile(0.95m).Time);
new FileInfo(System.IO.Path.Combine(OutputDirectory, "Results.html"))
.Write(string.Format(Result,
GetPercentile(OverallResults, 0.5m),
GetPercentile(OverallResults, 0.75m),
GetPercentile(OverallResults, 0.9m),
GetPercentile(OverallResults, 0.95m),
GetTimeTicks(OverallResults),
GetTableData(OverallResults),
GetCPUData(OverallResults),
GetMemoryData(OverallResults),
GetDescription(OverallResults),
"",
DateTime.Now.ToString("MM/dd/yyyy")));
Result = new FileInfo("resource://Sundial.DefaultFormatter/Sundial.DefaultFormatter.Index.html").Read();
new FileInfo(System.IO.Path.Combine(OutputDirectory, "Index.html"))
.Write(string.Format(Result,
GetSeriesList(Results),
DateTime.Now.ToString("MM/dd/yyyy")));
Dictionary<string, string> Scripts = new Dictionary<string, string>();
Scripts.Add("excanvas.min.js", "resource://Sundial.DefaultFormatter/Sundial.DefaultFormatter.Scripts.excanvas.min.js");
Scripts.Add("jquery-1.11.2.min.js", "resource://Sundial.DefaultFormatter/Sundial.DefaultFormatter.Scripts.jquery-1.11.2.min.js");
Scripts.Add("jquery.flot.axislabels.js", "resource://Sundial.DefaultFormatter/Sundial.DefaultFormatter.Scripts.jquery.flot.axislabels.js");
Scripts.Add("jquery.flot.min.js", "resource://Sundial.DefaultFormatter/Sundial.DefaultFormatter.Scripts.jquery.flot.min.js");
Scripts.Add("jquery.tablesorter.min.js", "resource://Sundial.DefaultFormatter/Sundial.DefaultFormatter.Scripts.jquery.tablesorter.min.js");
Scripts.ForEach(x =>
{
string Data = new FileInfo(x.Value);
new FileInfo(System.IO.Path.Combine(OutputDirectory + "\\Scripts", x.Key)).Write(Data);
});
Result = new FileInfo("resource://Sundial.DefaultFormatter/Sundial.DefaultFormatter.Styles.Layout.css").Read();
new FileInfo(System.IO.Path.Combine(OutputDirectory + "\\Styles", "Layout.css")).Write(Result);
}
示例4: MarkOldTypesAsDeleted
private static void MarkOldTypesAsDeleted(IZetboxContext ctx, ILookup<string, TypeRef> oldTypes, Dictionary<int, TypeRef> newTypes)
{
using (Logging.Log.InfoTraceMethodCallFormat("MarkOldTypesAsDeleted", "Updating refs"))
{
// Delete unused Refs
foreach (var tr in oldTypes.SelectMany(g => g))
{
var type = tr.AsType(false);
if (type == null)
{
Logging.Log.Warn("Should delete " + tr.FullName);
tr.Deleted = true;
}
else if (!type.IsGenericType)
{
if (!newTypes.ContainsKey(tr.ID))
{
Logging.Log.Warn("Should delete " + tr.FullName);
tr.Deleted = true;
}
}
else
{
tr.Deleted = null;
}
}
}
}