本文整理汇总了C#中IGrouping类的典型用法代码示例。如果您正苦于以下问题:C# IGrouping类的具体用法?C# IGrouping怎么用?C# IGrouping使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IGrouping类属于命名空间,在下文中一共展示了IGrouping类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConstructorsAmbiguous
/// <summary>
/// Generates a message saying that the constructor is ambiguous.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="bestDirectives">The best constructor directives.</param>
/// <returns>The exception message.</returns>
public static string ConstructorsAmbiguous(IContext context, IGrouping<int, ConstructorInjectionDirective> bestDirectives)
{
using (var sw = new StringWriter())
{
sw.WriteLine("Error activating {0} using {1}", context.Request.Service.Format(), context.Binding.Format(context));
sw.WriteLine("Several constructors have the same priority. Please specify the constructor using ToConstructor syntax or add an Inject attribute.");
sw.WriteLine();
sw.WriteLine("Constructors:");
foreach (var constructorInjectionDirective in bestDirectives)
{
FormatConstructor(constructorInjectionDirective.Constructor, sw);
}
sw.WriteLine();
sw.WriteLine("Activation path:");
sw.WriteLine(context.Request.FormatActivationPath());
sw.WriteLine("Suggestions:");
sw.WriteLine(" 1) Ensure that the implementation type has a public constructor.");
sw.WriteLine(" 2) If you have implemented the Singleton pattern, use a binding with InSingletonScope() instead.");
return sw.ToString();
}
}
示例2: MachineEditorVm
/// <summary>
/// Create a machine with the given SSAM Group
/// </summary>
/// <param name="machine"></param>
public MachineEditorVm(IGrouping<Model.Machine, Model.StateStationActivityMachine> machine)
{
_group = machine;
MachineId = machine.Key.Id;
Name = machine.Key.Name;
Code = machine.Key.Code;
}
示例3: ExportMasteries
/// <summary>
/// Exports the masteries.
/// </summary>
/// <param name="typeMasteries">The type masteries.</param>
/// <returns></returns>
private static IEnumerable<SerializableMastery> ExportMasteries(IGrouping<int, DgmTypeMasteries> typeMasteries)
{
List<SerializableMastery> listOfMasteries = new List<SerializableMastery>();
foreach (DgmMasteries typeMastery in typeMasteries.Select(x => Database.DgmMasteriesTable[x.MasteryID]))
{
Util.UpdatePercentDone(Database.MasteriesTotalCount);
int grade = typeMastery.Grade + 1;
SerializableMastery mastery;
if (listOfMasteries.All(x=> x.Grade != grade))
{
mastery = new SerializableMastery { Grade = grade };
listOfMasteries.Add(mastery);
}
else
mastery = listOfMasteries.First(x => x.Grade == grade);
SerializableMasteryCertificate masteryCertificate = new SerializableMasteryCertificate
{
ID = typeMastery.CertificateID,
ClassName =
Database.CrtClassesTable[Database.CrtCertificatesTable[typeMastery.CertificateID].ClassID].ClassName
};
mastery.Certificates.Add(masteryCertificate);
}
return listOfMasteries;
}
示例4: 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;
}
示例5: ReduceGroup
private static IEnumerable<KeyValuePair<IndexedName, RealNode>> ReduceGroup(
IEnumerable<KeyValuePair<IndexedName, RealNode>> aggr, IGrouping<XName, RealNode> items)
{
var addition = items.Select((elem, i) =>
new KeyValuePair<IndexedName, RealNode>(new IndexedName(items.Key, i), elem));
return aggr.Concat(addition);
}
示例6: 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);
}
示例7: 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");
}
示例8: ExportPendingChangesGroup
/// <summary>
/// Creates XML element containing the information on the specified pending changes group.
/// </summary>
public static XElement ExportPendingChangesGroup(IGrouping<IUserInfo, PendingChange> changesGroup)
{
return new XElement(
"group",
ExportUserInfo(changesGroup.Key),
from change in changesGroup select ExportPendingChange(change));
}
示例9: PackageFoundResult
public PackageFoundResult(IGrouping<string, IPackageInfo> packageInfos, PackageListOptions options, IEnumerable<IPackageInfo> currentPackages)
{
Options = options;
CurrentPackages = currentPackages;
Name = packageInfos.Key;
Packages = packageInfos.ToList();
}
示例10: FormatCanonicalizedValues
public static string FormatCanonicalizedValues(IGrouping<string, string> headerOrParameter)
{
return headerOrParameter.Key.ToLowerInvariant() + ":" +
String.Join(",", headerOrParameter
.Select(value => value.TrimStart().Replace("\r\n", String.Empty))
.OrderBy(value => value, StringComparer.OrdinalIgnoreCase));
}
示例11: 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;
}
示例12: ConvertEndsFacade
public ConvertEndsFacade(IGrouping<double, PanelBlRefExport> itemLefEndsByY, bool isLeftSide, ConvertPanelService cps)
{
this.itemLefEndsByY = itemLefEndsByY;
this.sideName = isLeftSide ? "левый" : "правый";
this.isLeftSide = isLeftSide;
CPS = cps;
}
示例13: 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>();
}
示例14: HtmlButtonGroup
private HtmlButtonGroup( HtmlForm form, IGrouping<string, IHtmlElement> inputGroup )
{
_form = form;
name = inputGroup.Key;
items = inputGroup.Select( e => new HtmlInputItem( this, e ) ).ToArray();
}
示例15: CreateModuleRouteSummary
private ModuleRouteSummary CreateModuleRouteSummary(IGrouping<Type, RouteInfo> moduleRouteInfos)
{
var moduleRouteSummary = new ModuleRouteSummary(moduleRouteInfos.Key.Name, _helpModulePath);
foreach (var routeInfo in moduleRouteInfos)
moduleRouteSummary.Routes.Add(new RouteSummary(routeInfo, _helpModulePath));
return moduleRouteSummary;
}