Questions tagged [igrouping]

The .NET interface for a collection of objects with a common key

The IGrouping interface, introduced in as part of , represents "a collection of objects with a common key".

It is typically encountered as a result of a GroupBy operation - for example

IGrouping<System.Reflection.MemberTypes, System.Reflection.MemberInfo> group =
    typeof(String).GetMembers().
    GroupBy(member => member.MemberType).
    First();

The members of the interface are used when handling results of any GroupBy operation. Questions that deal with handling the results of such GroupBy operations, or which otherwise construct objects that implement this interface, are expected to have this tag.

The interface itself defines available methods and properties which generally involve working with the objects inside the collection (or group).

76 questions
0
votes
1 answer

ADDRESS LIST OF IGROUPING OBJECT

I have a list of object grouped by this: Dim duplicates = test.GroupBy(Function(i) i.Total) _ .Where(Function(x) x.Count() > 1) _ .[Select](Function(x) x).ToList Now I can see throug the…
user18107302
0
votes
1 answer

How can I make a nested projection in a Linq query when using the group by clause?

I'm trying to work with grouped data coming back from SQL. The method I'm writing is to provide the data for a "Case Status Overview" screen. It must produce a nested XML document. Now, I could do it the easy way, but I'm trying to learn whether…
RoboJ1M
  • 1,590
  • 2
  • 27
  • 34
0
votes
0 answers

Skipping a column that is part of GROUP BY statement in nested foreach-loops?

I'm adding data to a SQL database (thousands of rows), aggregating the columns, and then using the processed data to build invoices (tens of rows per invoice). I GROUP BY three columns: GROUP BY [KjøretøyID], [LøyvehaverID],…
Ole M
  • 317
  • 1
  • 17
0
votes
2 answers

IGrouping avoiding anonymous types

I would like to know how to group data avoiding anonymous types, because the keys may be one, two.. according to customer selection. Example: We have a class public class Customer { public string Name { get; set; } public int Age { get;…
Jesus Hedo
  • 119
  • 1
  • 1
  • 10
0
votes
1 answer

How to get value from IGrouping where key and value in object match

I have a database table with three columns: CodeType, Code, Name I am holding the values in memory, a poor man's cache if you will with the values assigned to a Lookup. public class ShortCodeCache { public DateTime LastRefresh { get; set; } …
Connie DeCinko
  • 802
  • 2
  • 15
  • 32
0
votes
1 answer

Create IGrouping within IGrouping

I have a List of flat ViewModels. var initialList = new List { new ViewModel { OuterCaption = "A outer", InnerCaption = "A inner", Caption = "E", Id = 8}, new ViewModel { OuterCaption = "B outer", InnerCaption = "B inner", Caption…
julian.a
  • 1,163
  • 2
  • 9
  • 21
0
votes
0 answers

Calling custom IQueryable extension methods on an IGrouping

I have code very much like this: Context.History.GroupBy(d => new { d.Category, d.Month }) .Select(group => new { Category = group.Key.Category, Month = group.Key.Month, // Geometric mean: Value =…
0
votes
1 answer

get count of all the grouped items in all groups from IEnumerable> GroupBy

I have grouped together fruits by certain common properties (weight, color, etc) using LINQ GroupBy, and then I have done some processing that removes some groups from that list of IGroupings (together with all the fruits in that group). Now, I…
Carl Nathan Mier
  • 51
  • 1
  • 1
  • 7
0
votes
1 answer

Redirect IGrouping List to another action in Same Controller

return RedirectToAction("ActionName", new { lst = finalData }); [HttpGet] Public ActionResult AcionName(IGrouping lst) { return View("ActionName", lst); } i use this code to redirect my list to another action but this is not…
0
votes
1 answer

How do you page IGrouping on the grouped items rather than the group

I'm trying to use skip and take on IGrouping but I don't want to page on the grouped key I want to do it on the items that have been grouped.
Gaz
  • 1,249
  • 3
  • 19
  • 37
0
votes
2 answers

C# How can I Cast/Convert a IEnumerable> to another type?

So, I am trying to cast the following variable: IEnumerable> GroupedValues; To this: IEnumerable> GroupedValues; I have tried using Cast and also Convert.ChangeType(GroupedValues, typeof(int)); but if…
Innat3
  • 3,561
  • 2
  • 11
  • 29
0
votes
0 answers

SemanticZoom's ToggleActiveView method throws AccessViolationException

I have a GridView in a UWP app that does not contain grouped items. So I can't just put it in a SemanticZoom and have the headers be used as toggles to "zoom out" to a jump list. Instead, I am relying on 1) touch-screen users to pinch-zoom and 2)…
Lee McPherson
  • 931
  • 6
  • 20
0
votes
1 answer

Return IGrouping of anonymous IEnumerable to present on DataGrid

On WPF I build this code I want to show on datagrid the sum of "Desc" for each "PID" public class Event { public int PID { get; set; } public int Desc { get; set; } } private List data; public MainWindow() { …
jordan
  • 119
  • 2
  • 3
  • 10
0
votes
1 answer

Dictionary as a Lookup value

To have a holiday calculation I have to load holidays from repository for a year and for multiple countries and their state. To get good performance in a logic where I need to check if a date is holiday or not, I am trying to convert a list to…
Imran Rizvi
  • 7,331
  • 11
  • 57
  • 101
0
votes
2 answers

Check if key value exists in multiple IGrouping and remove if they don't

var boughtApples = apples.GroupBy(x => BoughtById); var boughtCoconuts = coconuts.GroupBy(x => x.BoughtById); var boughtOranges = oranges.GroupBy(x => x.BoughtById); I want to get the key values BoughtById who bought all three items and then…
user4884237