本文整理汇总了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;
}
示例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");
}
示例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;
}
示例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;
}
示例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);
}
示例6: PerformJobs
private void PerformJobs(IGrouping<ISynchronizeInvoke, UpdateUIJob> jobGroup)
{
var firstJob = jobGroup.First();
jobGroup.Where(job => job != firstJob).ForEach(firstJob.MergeWith);
firstJob.Perform();
}
示例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>();
}
示例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;
}
示例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();
}
示例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); });
}
}
}
示例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();
}
示例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();
}
示例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
};
}
示例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;
}
示例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;
}