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


C# IGrouping.First方法代码示例

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


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

示例1: 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;
 }
开发者ID:GHLabs,项目名称:SambaPOS-3,代码行数:7,代码来源:GroupedOrderTagViewModel.cs

示例2: TableInfo

		//internal TableInfo(DB2Connection connection, DB2DataReader reader)
		//{
		//	_connection = connection;

		//	Name = Convert.ToString(reader.GetValue(reader.GetOrdinal("NAME")));
		//	Remarks = Convert.ToString(reader.GetValue(reader.GetOrdinal("REMARKS")));
		//}

		internal TableInfo(IGrouping<string, DataRow> data)
		{
			_data = data;

			Name = data.First().Field<string>("TBNAME");
			Remarks = data.First().Field<string>("TBREMARKS");
		}
开发者ID:treytomes,项目名称:DB2LinqPadDriver,代码行数:15,代码来源:TableInfo.cs

示例3: CreateAttendanceDTO

 private static DeptWiseAttendanceDTO CreateAttendanceDTO(IGrouping<int, ActivityLogDTO> grp, IEnumerable<Employee> allEmployees)
 {
     var deptMembers = allEmployees.Where(e => e.Deprtment.Id == grp.First().Department.Id);
     var dto = new DeptWiseAttendanceDTO
     {
         DepartmentName = grp.First().Department.Name,
         Attendance = grp.GroupBy(gd => gd.Employee.Id)
                         .Select(empGroup => new AttendanceDTO
                         {
                             EmployeeName = empGroup.First().Employee.Name,
                             EmployeeId = empGroup.First().Employee.Id,
                             Attended = true,
                             Date = empGroup.First().TimeStamp.ToString("yyyy-MM-dd")
                         })
                         .ToList()
     };
     var absents = deptMembers.Where(m => !dto.Attendance.Any(a => a.EmployeeId == m.Id));
     var date = dto.Attendance.First().Date;
     dto.Attendance.AddRange(absents.Select(a => new AttendanceDTO
                         {
                             EmployeeName = a.Name,
                             EmployeeId = a.Id,
                             Attended = false,
                             Date = date
                         }));
     return dto;
 }
开发者ID:chakrabar,项目名称:AccessAdmin,代码行数:27,代码来源:ReportGeneratorFacade.cs

示例4: 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;
 }
开发者ID:hpbaotho,项目名称:sambapos,代码行数:9,代码来源:MenuItemGroupedPropertyViewModel.cs

示例5: GetEventFromGroup

 public static PageRequest GetEventFromGroup(IGrouping<Guid, PageRequest> group)
 {
     var element = group.First();
     var other = group.Skip(1).ToList();
     if (other.Count == 0) return element;
     else return new RequestSessionGroup(element, other);
 }
开发者ID:DCT-UA,项目名称:Monator,代码行数:7,代码来源:RequestSessionGroup.cs

示例6: PerformJobs

        private void PerformJobs(IGrouping<ISynchronizeInvoke, UpdateUIJob> jobGroup)
        {
            var firstJob = jobGroup.First();

            jobGroup.Where(job => job != firstJob).ForEach(firstJob.MergeWith);

            firstJob.Perform();
        }
开发者ID:subTee,项目名称:Deviare2,代码行数:8,代码来源:UIUpdater.cs

示例7: parseClientGroup

 private static IEnumerable<IAutoCompleteListItem> parseClientGroup(IGrouping<ulong, Toggl.TogglAutocompleteView> c)
 {
     var projectItems = c.GroupBy(p => p.ProjectID).Select(parseProjectGroup);
     if (c.Key == 0)
         return projectItems;
     var clientName = c.First().ClientLabel;
     return new ClientCategory(clientName, projectItems.ToList()).Yield<IAutoCompleteListItem>();
 }
开发者ID:Nukil,项目名称:toggldesktop,代码行数:8,代码来源:AutoCompleteControllers.cs

示例8: AirCondRow

 public AirCondRow(IGrouping<Color, AirConditioner> groupCond)
 {
     var firstAir = groupCond.First();
     Color = groupCond.Key;
     AirConds = groupCond.ToList();
     Count = AirConds.Count;
     ColorName = firstAir.ColorName;
     Mark = firstAir.Mark;
 }
开发者ID:vildar82,项目名称:PanelColorAlbum,代码行数:9,代码来源:AirCondRow.cs

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

示例10: ProcessSubscription

 private static void ProcessSubscription(IGrouping<string, Subscription> userSubs)
 {
     string cookie = string.Empty;
     foreach (var sub in userSubs)
     {
         string fileName = GenerateReport(sub, sub == userSubs.First(), ref cookie);
         if (fileName != string.Empty)
         {
             Task.Factory.StartNew(() => { SendEmail(sub, fileName); });
         }
     }
 }
开发者ID:HarryNing,项目名称:TableauDistTool,代码行数:12,代码来源:Program.cs

示例11: Generate

		static string Generate(IGrouping<string, MethodDom> group)
		{
			var first = group.First();
			XElement body;
			var doc = GetDoc(out body);
			body.Add(
				x("h1", first.Type.SimpleName + GetMemberName(first) + Names[Strings.SuffixDelimeter] +
					Names[GetMethodKindName(first)] + " " ),
				BuildMembers("OverloadList",group)
			);
			return doc.ToString();
		}
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:12,代码来源:GenerateHtml_Member.cs

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

示例13: _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

示例14: FindMaxVersionPlugin

 private static IPlugin FindMaxVersionPlugin(IGrouping<string, IPlugin> plugins)
 {
     Debug.Assert(plugins.Any());
     var maxVersionPlugin = plugins.First();
     foreach (var plugin in plugins)
     {
         if (maxVersionPlugin.Version.CompareTo(plugin.Version) == -1)
         {
             LogManager.Warning(String.Format("Found previous version of plugin.       Current version:" + PluginTostring(plugin) +
                 "          Previous version: " + PluginTostring(maxVersionPlugin)));
             maxVersionPlugin = plugin;
         }
         else
         {
             if (maxVersionPlugin != plugin)
             {
                 LogManager.Warning(String.Format("Found previous version of plugin.     Current version: " +
                                   PluginTostring(maxVersionPlugin) +"        Previous version: " + PluginTostring(plugin)));
             }
         }
     }
     return maxVersionPlugin;
 }
开发者ID:romanburtnyk,项目名称:FileManager,代码行数:23,代码来源:PluginLoadingHelper.cs

示例15: CreateQuizInfoForDb

		private IEnumerable<QuizInfoForDb> CreateQuizInfoForDb(ChoiceBlock choiceBlock, IGrouping<string, QuizAnswer> answers)
		{
			if (!choiceBlock.Multiple)
			{
				var answerItemId = answers.First().ItemId;
				var isTrue = choiceBlock.Items.First(x => x.Id == answerItemId).IsCorrect;
				return new List<QuizInfoForDb>
				{
					new QuizInfoForDb
					{
						QuizId = choiceBlock.Id,
						ItemId = answerItemId,
						IsRightAnswer = isTrue,
						Text = null,
						QuizType = typeof (ChoiceBlock),
						IsRightQuizBlock = isTrue
					}
				};
			}
			var ans = answers.Select(x => x.ItemId).ToList()
				.Select(x => new QuizInfoForDb
				{
					QuizId = choiceBlock.Id,
					IsRightAnswer = choiceBlock.Items.Where(y => y.IsCorrect).Any(y => y.Id == x),
					ItemId = x,
					Text = null,
					QuizType = typeof(ChoiceBlock),
					IsRightQuizBlock = false
				}).ToList();
			var isRightQuizBlock = ans.All(x => x.IsRightAnswer) &&
						 choiceBlock.Items.Where(x => x.IsCorrect)
							 .Select(x => x.Id)
							 .All(x => ans.Where(y => y.IsRightAnswer).Select(y => y.ItemId).Contains(x));
			foreach (var info in ans)
				info.IsRightQuizBlock = isRightQuizBlock;
			return ans;
		}
开发者ID:fakefeik,项目名称:uLearn,代码行数:37,代码来源:QuizController.cs


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