本文整理汇总了C#中IGrouping.Select方法的典型用法代码示例。如果您正苦于以下问题:C# IGrouping.Select方法的具体用法?C# IGrouping.Select怎么用?C# IGrouping.Select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGrouping
的用法示例。
在下文中一共展示了IGrouping.Select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReduceGroup
private static IEnumerable<KeyValuePair<IndexedName, RealNode>> ReduceGroup(
IEnumerable<KeyValuePair<IndexedName, RealNode>> aggr, IGrouping<XName, RealNode> items)
{
var addition = items.Select((elem, i) =>
new KeyValuePair<IndexedName, RealNode>(new IndexedName(items.Key, i), elem));
return aggr.Concat(addition);
}
示例2: ExportMasteries
/// <summary>
/// Exports the masteries.
/// </summary>
/// <param name="typeMasteries">The type masteries.</param>
/// <returns></returns>
private static IEnumerable<SerializableMastery> ExportMasteries(IGrouping<int, DgmTypeMasteries> typeMasteries)
{
List<SerializableMastery> listOfMasteries = new List<SerializableMastery>();
foreach (DgmMasteries typeMastery in typeMasteries.Select(x => Database.DgmMasteriesTable[x.MasteryID]))
{
Util.UpdatePercentDone(Database.MasteriesTotalCount);
int grade = typeMastery.Grade + 1;
SerializableMastery mastery;
if (listOfMasteries.All(x=> x.Grade != grade))
{
mastery = new SerializableMastery { Grade = grade };
listOfMasteries.Add(mastery);
}
else
mastery = listOfMasteries.First(x => x.Grade == grade);
SerializableMasteryCertificate masteryCertificate = new SerializableMasteryCertificate
{
ID = typeMastery.CertificateID,
ClassName =
Database.CrtClassesTable[Database.CrtCertificatesTable[typeMastery.CertificateID].ClassID].ClassName
};
mastery.Certificates.Add(masteryCertificate);
}
return listOfMasteries;
}
示例3: FormatCanonicalizedValues
public static string FormatCanonicalizedValues(IGrouping<string, string> headerOrParameter)
{
return headerOrParameter.Key.ToLowerInvariant() + ":" +
String.Join(",", headerOrParameter
.Select(value => value.TrimStart().Replace("\r\n", String.Empty))
.OrderBy(value => value, StringComparer.OrdinalIgnoreCase));
}
示例4: GroupedOrderTagViewModel
public GroupedOrderTagViewModel(Order selectedItem, IGrouping<string, OrderTagGroup> orderTagGroups)
{
Name = orderTagGroups.Key;
OrderTags = orderTagGroups.Select(x => new GroupedOrderTagButtonViewModel(selectedItem, x)).ToList();
ColumnCount = orderTagGroups.First().ColumnCount;
ButtonHeight = orderTagGroups.First().ButtonHeight;
}
示例5: CreateVirtualDirectory
protected virtual ResourceVirtualDirectory CreateVirtualDirectory(IGrouping<string, string[]> subResources)
{
var remainingResourceNames = subResources.Select(g => g[1]);
var subDir = new ResourceVirtualDirectory(
VirtualPathProvider, this, backingAssembly, subResources.Key, remainingResourceNames);
return subDir;
}
开发者ID:grammarware,项目名称:fodder,代码行数:8,代码来源:src_ServiceStack_Razor_VirtualPath_ResourceVirtualDirectory.cs
示例6: HtmlButtonGroup
private HtmlButtonGroup( HtmlForm form, IGrouping<string, IHtmlElement> inputGroup )
{
_form = form;
name = inputGroup.Key;
items = inputGroup.Select( e => new HtmlInputItem( this, e ) ).ToArray();
}
示例7: MenuItemGroupedPropertyViewModel
public MenuItemGroupedPropertyViewModel(TicketItemViewModel selectedItem, IGrouping<string, MenuItemPropertyGroup> menuItemPropertyGroups)
{
Name = menuItemPropertyGroups.Key;
Properties = menuItemPropertyGroups.Select(x => new MenuItemGroupedPropertyItemViewModel(selectedItem, x)).ToList();
ColumnCount = menuItemPropertyGroups.First().ColumnCount;
ButtonHeight = menuItemPropertyGroups.First().ButtonHeight;
TerminalButtonHeight = menuItemPropertyGroups.First().TerminalButtonHeight;
TerminalColumnCount = menuItemPropertyGroups.First().TerminalColumnCount;
}
示例8: OnSelector
private DebuggerViewItem OnSelector(IGrouping<IHandler, Burden> lookup)
{
var handler = lookup.Key;
var objects = lookup.Select(g => g.Instance).ToArray();
var view = ComponentDebuggerView.BuildFor(handler);
return new DebuggerViewItem(handler.GetComponentName(),
"Count = " + objects.Length,
new ReleasePolicyTrackedObjectsDebuggerViewItem(view, objects));
}
示例9: HeroStatistic
public HeroStatistic(IGrouping<string, Match> group)
{
Hero = group.Key;
Matches = group.Count();
Wins = group.Where(m => m.Win).Count();
Losses = group.Where(m => m.Win == false).Count();
WinRatio = Convert.ToInt32((double)Wins / (double)Matches * 100);
TimePlayed = group.Select(g => g.Duration).Aggregate(TimeSpan.Zero, (subtotal, t) => subtotal.Add(t));
}
示例10: GetApi
private static Api GetApi(IGrouping<string, SwaggerRouteData> @group)
{
return new Api
{
Path = @group.Key,
Operations = @group
.Select(d => d.ToOperation())
.OrderBy(o => o.Method)
};
}
示例11: CreateMenuItemModel
private MenuItemModel CreateMenuItemModel(IGrouping<string, HeaderNavigationDTO> menuGroup, bool isParentSelected, int? selectedHeaderId)
{
var headers = menuGroup.Select(m => CreateHeaderItemModel(m, selectedHeaderId, isParentSelected));
return new MenuItemModel()
{
IsExpanded = isParentSelected && headers.Any(h => h.IsSelected),
Name = menuGroup.Key,
Headers = headers
};
}
示例12: GenerateApiSpec
private ApiSpec GenerateApiSpec(IGrouping<string, ApiDescription> apiDescriptionGroup, ModelSpecMap modelSpecMap)
{
var operationSpecs = apiDescriptionGroup
.Select(apiDesc => GenerateOperationSpec(apiDesc, modelSpecMap))
.ToList();
return new ApiSpec
{
Path = "/" + apiDescriptionGroup.Key.Split('?').First(),
Operations = operationSpecs
};
}
示例13: CreateApiSpec
private ApiSpec CreateApiSpec(IGrouping<string, ApiDescription> apiDescriptionGroup, ModelSpecRegistrar modelSpecRegistrar)
{
var operationSpecs = apiDescriptionGroup
.Select(apiDesc => _operationSpecGenerator.From(apiDesc, modelSpecRegistrar))
.ToList();
return new ApiSpec
{
Path = "/" + apiDescriptionGroup.Key.Split('?').First(),
Operations = operationSpecs
};
}
示例14: CreateApi
private Api CreateApi(IGrouping<string, ApiDescription> apiDescriptionGroup, OperationGenerator operationGenerator)
{
var operations = apiDescriptionGroup
.Select(operationGenerator.ApiDescriptionToOperation)
.OrderBy(op => op.Method)
.ToList();
return new Api
{
Path = "/" + apiDescriptionGroup.Key,
Operations = operations
};
}
示例15: CreateApi
private Api CreateApi(IGrouping<string, ApiDescription> apiDescriptionGroup, Dictionary<string, DataType> complexModels)
{
var operations = apiDescriptionGroup
.Select(apiDesc => _operationGenerator.ApiDescriptionToOperation(apiDesc, complexModels))
.OrderBy(op => op.Method)
.ToList();
return new Api
{
Path = "/" + apiDescriptionGroup.Key,
Operations = operations
};
}