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


C# IGrouping.OrderByDescending方法代码示例

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


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

示例1: Reduce

        private static IEnumerable<SecurityAttributeDescriptor> Reduce(IGrouping<string, SecurityAttributeDescriptor> g)
        {
            var overrides = g.Where(d => d.Override != SecurityAttributeOverride.None).ToList();
            switch (overrides.Count)
            {
                case 0:
                    yield return g.OrderByDescending(d => d.AttributeType).First();
                    break;

                case 1:
                    var @override = overrides[0];
                    if (@override.Override == SecurityAttributeOverride.Add)
                        yield return new SecurityAttributeDescriptor(@override.AttributeType, @override.Target, @override.Signature);
                    break;

                default:
                    throw new ArgumentException(string.Format("Conflicting overrides: {0}", overrides));
            }
        }
开发者ID:tigerhu67,项目名称:monobuildtools,代码行数:19,代码来源:SecurityAttributeDescriptorOperations.cs

示例2: ComputeOffsetBetweenEvents

        private DataAroundEvent[] ComputeOffsetBetweenEvents(IGrouping<string, DataAroundEvent>[] orderEventGroups, IGrouping<string, DataAroundEvent> midGroup)
        {
            // compute offset between each event to center group
            DataAroundEvent[] repivotEvents;
            repivotEvents = orderEventGroups.SelectMany(@group =>
                @group.Select(d =>
                {
                    var eventPicked = @group.OrderByDescending(e => e.EventDate).FirstOrDefault(g => g.EventDate > DateTime.Today.AddDays(-numberOfPointsAroundEvent));
                    int busDayDiff = 0;
                    if (eventPicked != null)
                    {
                        busDayDiff = BusDayDiff(midGroup.OrderByDescending(e => e.EventDate).First(x => x.EventDate > DateTime.Today.AddDays(-numberOfPointsAroundEvent)).EventDate, eventPicked.EventDate);
                    }                    
                    var ar = new DataAroundEvent(d.EventDate, d.Instrument, d.RawData, d.NumPointsAroundEvent, d.EventCode, busDayDiff)
                    {
                        PivotIndex = pivotIndex,
                    };
                    return ar;
                })).ToArray();

            return repivotEvents;            

        }
开发者ID:heimanhon,项目名称:researchwork,代码行数:23,代码来源:MultiEventDisplayOrganiser.cs

示例3: AssignReleaseStatus

        /// <summary>
        /// Assigns the release status.
        /// </summary>
        /// <param name="processItem">The process item.</param>
        private static void AssignReleaseStatus(IGrouping<byte?, ProcessComplianceListItem> processItem)
        {
            var currentDate = DateTimeHelper.RetrieveCurrentDate();
            var currentDateTime = DateTimeHelper.RetrieveCurrentDateTime();

            ////For past releases.
            var processComplianceListItem = processItem.OrderByDescending(u => u.StartDate).FirstOrDefault(u => u.StartDate <= currentDateTime);
            int missedArtifactsCount;

            ////When Artifacts are missed.
            if (processComplianceListItem != null)
            {
                missedArtifactsCount = (from listItem in processComplianceListItem.Items where listItem.DueDate < currentDate && listItem.Status != (byte)ArtifactStatus.Completed select listItem).Count();
                if (missedArtifactsCount > 0)
                {
                    processComplianceListItem.ReleaseArtifactsMissedCount = missedArtifactsCount;
                }
            }

            ////When release has not been completed on EndDate.
            if (processComplianceListItem != null && processComplianceListItem.ReleaseStatus.HasValue && processComplianceListItem.EndDate.HasValue && processComplianceListItem.EndDate < currentDateTime && !processComplianceListItem.ReleaseStatus.Equals((byte)ReleaseStatus.Completed))
            {
                processComplianceListItem.IsReleaseNotCompleted = true;
            }

            ////For future releases.
            processComplianceListItem = processItem.OrderBy(u => u.StartDate).FirstOrDefault(u => u.StartDate >= currentDateTime);
            ////When Artifacts are missed.
            if (processComplianceListItem != null)
            {
                missedArtifactsCount = (from listItem in processComplianceListItem.Items where listItem.DueDate < currentDate && listItem.Status != (byte)ArtifactStatus.Completed select listItem).Count();
                if (missedArtifactsCount > 0)
                {
                    processComplianceListItem.ReleaseArtifactsMissedCount = missedArtifactsCount;
                }
            }

            ////When risk at release level for future releases.
            if (processComplianceListItem != null && processComplianceListItem.Items.Any(u => u.ReleaseAtRiskFlag.HasValue && u.ReleaseAtRiskFlag.Value))
            {
                processComplianceListItem.IsReleaseAtRisk = true;
            }
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:47,代码来源:ProjectDashboardController.cs


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