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


C# IGrouping.OrderBy方法代码示例

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


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

示例1: CreateFilterGroupModel

 private FilterGroupModel CreateFilterGroupModel(IGrouping<int, FilterDTO> filterDTOGroup, string locationID, string database)
 {
     return new FilterGroupModel()
     {
         FilterGroupItems = filterDTOGroup.OrderBy(f => f.ViewOrder).Select(f => CreateBaseFilter(f, locationID, database)).ToList(),
         Index = filterDTOGroup.Key
     };
 }
开发者ID:Dani88,项目名称:GFIS,代码行数:8,代码来源:ReportFilterFactory.cs

示例2: CreateFileFor

 private static void CreateFileFor(IGrouping<string, Translation> group)
 {
     const string @namespace = "TODO.Your.Namespace";
     var ietfLanguageTag = group.Key.ToLower();
     var className = string.Concat(char.ToUpper(ietfLanguageTag[0]), ietfLanguageTag.Substring(1));
     var translationBuilder = new StringBuilder();
     foreach (var translation in group.OrderBy(t => t.XPath))
     {
         translationBuilder.AppendFormat(@"                            new Translation{{ResourceKey = ""{0}"", Text = @""{1}""}},{2}", translation.XPath, translation.Content, Environment.NewLine);
     }
     var content = string.Format(TemplateFile, @namespace, className, ietfLanguageTag, translationBuilder);
     var filePath = string.Format(@"{0}\{1}.cs", OutputPath, className);
     File.WriteAllText(filePath, content);
 }
开发者ID:kirolosgerges,项目名称:Blog,代码行数:14,代码来源:Program.cs

示例3: _CreateSingleMembershipWithCorrectStatus

        private static MembershipDetails _CreateSingleMembershipWithCorrectStatus(IGrouping<int, MembershipDetails> groupedDetails)
        {
            var firstDetails = groupedDetails.First();

            var statusToUse = groupedDetails
                .OrderBy(d => d.MembershipStatus)
                .First().MembershipStatus;

            return new MembershipDetails
            {
                BecNumber = firstDetails.BecNumber,
                FirstName = firstDetails.FirstName,
                LastName = firstDetails.LastName,
                MembershipStatus = statusToUse
            };
        }
开发者ID:robhughadams,项目名称:PaxtonSync,代码行数:16,代码来源:Program.cs

示例4: DisplayGroupResults

        static void DisplayGroupResults(IGrouping<int, RunResult> group)
        {
            Console.WriteLine("Benchmark {0}, Runner {1}, {2} iterations", group.First().BenchmarkType.Name,
                              group.First().RunnerType.Name, group.Key);

            Console.WriteLine();
            Console.WriteLine("{0,-30}{1,-14}{2,-12}{3,-10}{4}", "Implementation", "Duration", "Difference", "Each",
                              "Multiplier");
            Console.WriteLine(new string('=', 78));

            IOrderedEnumerable<RunResult> ordered = group.OrderBy(x => x.Duration);

            RunResult best = ordered.First();

            ordered.Select(x => new DisplayResult(x, best))
                .Each(DisplayResult);

            Console.WriteLine();
        }
开发者ID:scptre,项目名称:Magnum,代码行数:19,代码来源:Program.cs

示例5: DisplayGroupResults

        static void DisplayGroupResults(IGrouping<int, RunResult> group)
        {
            Console.WriteLine("Benchmark {0}, Runner {1}, {2} iterations", group.First().BenchmarkType.Name,
                group.First().RunnerType.Name, group.Key);

            Console.WriteLine();
            Console.WriteLine("{0,-30}{1,-14}{2,-12}{3,-10}{4,-12}{5,-12}{6}", "Implementation", "Duration",
                "Difference", "Each",
                "Multiplier", "Memory(KB)", "Throughput");
            Console.WriteLine(new string('=', 102));

            IOrderedEnumerable<RunResult> ordered = group.OrderBy(x => x.Duration);

            RunResult best = ordered.First();

            IEnumerable<DisplayResult> results = ordered.Select(x => new DisplayResult(x, best));
            foreach (DisplayResult x in results)
            {
                DisplayResult(group.Key, x);
            }

            Console.WriteLine();
        }
开发者ID:phatboyg,项目名称:Benchmarque,代码行数:23,代码来源:Program.cs

示例6: 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

示例7: ToJsonModel

 private InsuranceGroupJsonModel ToJsonModel(IGrouping<PolicyType, Insurance> group)
 {
     if (group == null) return null;
     return new InsuranceGroupJsonModel()
     {
         GroupId = group.Key.Id,
         GroupName = group.Key.Name,
         Insurances = group.OrderBy(x => x.Order).Select(ToJsonModel).ToList()
     };
 }
开发者ID:sgh1986915,项目名称:hippobiliing-asp.net-html,代码行数:10,代码来源:PatientsController.cs

示例8: CreateRecordFromGrouping

 private static VerizonRecord CreateRecordFromGrouping(IGrouping<string, VerizonRecord> g)
 {
     return new VerizonRecord
     {
         Date = g.OrderBy(r => r.Date).Last().Date,
         Description = g.First().Description,
         Minutes = g.Sum(r => r.Minutes),
         Number = g.Key
     };
 }
开发者ID:paveltimofeev,项目名称:Caliberweb-Core,代码行数:10,代码来源:VerizonMinutesReader.cs

示例9: compileSingleSentece

        /// <summary>
        /// Собирает предложение по частям
        /// </summary>
        /// <param name="parts"></param>
        /// <returns></returns>
        private static Sentence compileSingleSentece(IGrouping<int, RawSentencePart> parts)
        {
            var builder = parts.OrderBy(part => part.Position)
                .Aggregate(new SentenceBuilder(), (sentenceBuilder, part) => sentenceBuilder.Add(part));

            return builder.Sentence;
        }
开发者ID:Ogonik,项目名称:LWS,代码行数:12,代码来源:Parser.cs

示例10: ActivityEditorVm

		public ActivityEditorVm(
			Model.Task task, 
			Dal.SoheilEdmContext uow,
			IGrouping<Model.Activity, Model.StateStationActivity> ssaGroup)
			: base(ssaGroup.Key)
		{
			Message = new Common.SoheilException.EmbeddedException();

			if (!ssaGroup.Any())
			{
				Message.AddEmbeddedException("فعالیتی وجود ندارد");
				return;
			}

			//make ProcessList self-aware of all changes
			ProcessList.CollectionChanged += (s, e) =>
			{
				if (e.NewItems != null)
					foreach (ProcessEditorVm processVm in e.NewItems)
					{
						ProcessList_Added(processVm);
					}
			};

			//Add Choices
			foreach (var choice in ssaGroup.OrderBy(ssa => ssa.ManHour))
			{
				Choices.Add(new ChoiceEditorVm(choice));
			}

			//Add existing processes
			foreach (var process in task.Processes.Where(x => x.StateStationActivity.Activity.Id == ssaGroup.Key.Id))
			{
				ProcessList.Add(new ProcessEditorVm(process, Model, uow));
			}

			//Add process command
			AddProcessCommand = new Commands.Command(o =>
			{
				
				DateTime dt;
				if (GetTaskStart == null)
					dt = ProcessList.Any() ?
						ProcessList
							.Where(x => x.ActivityModel.Id == ssaGroup.Key.Id)
							.Max(x => x.Model.EndDateTime)
						: task.StartDateTime;
				else
					dt = GetTaskStart();

				var minMH = ssaGroup.Min(x => x.ManHour);

				var processVm = new ProcessEditorVm(
					new Model.Process
					{
						StartDateTime = dt,
						EndDateTime = dt,
						StateStationActivity = ssaGroup.First(x=>x.ManHour == minMH),
						TargetCount = 0,
						Task = task,
					}, Model, uow);//activity Model is set here
				ProcessList.Add(processVm);
				processVm.IsSelected = true;
			});
		}
开发者ID:T1Easyware,项目名称:Soheil,代码行数:65,代码来源:ActivityEditorVm.cs

示例11: BuildForRepo

        private string BuildForRepo(string repoName, IGrouping<string, RepoAndBranchInfo> repoAndBranchInfos)
        {
            var sb = new StringBuilder();
            sb.Append(AddColumnHeaders());
            var orderedByDateDesc = repoAndBranchInfos.OrderBy(b => b.BranchInfo.CommitterDate.Date);
            foreach (var repoAndBranchInfo in orderedByDateDesc)
            {
                var branchInfo = repoAndBranchInfo.BranchInfo;
                var branchName = branchInfo.Name.Length > Constants.EmailCommitBranchNameLength ? branchInfo.Name.Substring(0, Constants.EmailCommitBranchNameLength) : branchInfo.Name;
                var commitMessage = branchInfo.Message.Length > Constants.EmailCommitMessageLength ? branchInfo.Message.Substring(0, Constants.EmailCommitMessageLength) : branchInfo.Message;
                sb.Append(AddBranchInfo(branchInfo, branchName, commitMessage));
            }

            return h3(repoName) + table(sb.ToString());
        }
开发者ID:CBurbidge,项目名称:ShamefulOldGit,代码行数:15,代码来源:EmailBuilder.cs


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