本文整理汇总了C#中IGrouping.All方法的典型用法代码示例。如果您正苦于以下问题:C# IGrouping.All方法的具体用法?C# IGrouping.All怎么用?C# IGrouping.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGrouping
的用法示例。
在下文中一共展示了IGrouping.All方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateOperationMetadataGroup
/// <summary>
/// Validates a group of operations with the same context Uri.
/// </summary>
/// <param name="operations">Operations to validate.</param>
private void ValidateOperationMetadataGroup(IGrouping<string, ODataOperation> operations)
{
Debug.Assert(operations != null, "operations must not be null.");
Debug.Assert(operations.Any(), "operations.Any()");
Debug.Assert(operations.All(o => this.GetOperationMetadataString(o) == operations.Key), "The operations should be grouped by their metadata.");
if (operations.Count() > 1 && operations.Any(o => o.Target == null))
{
throw new ODataException(OData.Core.Strings.ODataJsonLightEntryAndFeedSerializer_ActionsAndFunctionsGroupMustSpecifyTarget(operations.Key));
}
foreach (IGrouping<string, ODataOperation> operationsByTarget in operations.GroupBy(this.GetOperationTargetUriString))
{
if (operationsByTarget.Count() > 1)
{
throw new ODataException(OData.Core.Strings.ODataJsonLightEntryAndFeedSerializer_ActionsAndFunctionsGroupMustNotHaveDuplicateTarget(operations.Key, operationsByTarget.Key));
}
}
}
示例2: GetCss
private IEnumerable<string> GetCss(IGrouping<int, ShoppingListItemModel> lookup)
{
if (lookup.All(x => x.Css.Length > 0)) yield return "nothing-needed";
if (lookup.All(x => x.Css == "zero")) yield return "zero";
if (lookup.All(x => x.Css == "picked")) yield return "picked";
}