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
4
votes
1 answer

Detecting if an IEnumerable is Grouped, I'm getting some crazy results when checking the types

So I'm trying to figure out if some any random IEnumerable passed to my method has been grouped. The idea being that I'm going to handle grouped data differently. My problem is the IGrouping<> is a generic interface that doesn't implement a…
Ben Lesh
  • 107,825
  • 47
  • 247
  • 232
4
votes
2 answers

C# LINQ GroupBy to convert a List to a group with one property as List of values

I have a list of objects list1 Name Value N1 V100 N2 V101 N1 V102 N4 V103 N4 V104 I want to convert this into a grouped List Name Values N1 V100, V102 N2 V101 N4 V103, V104 When I use GroupBy I get the whole thing, (…
heyNow
  • 866
  • 2
  • 19
  • 42
4
votes
1 answer

How to handle IEnumerable with IGrouping in the view?

I am trying to send to the view an IEnumerable and to show every element in it but I have a problem when I send it. It says…
SH.IN
  • 71
  • 2
  • 11
3
votes
1 answer

Finding duplicates in IGrouping Using linq

I would like to get the other number of games the same person has played in on. For example lisa plays in game 7 which is 1 other game. Tim and Josh both play in game 2 but also play in 3 other games. Is there a way through Igrouping to compare…
Allee Clark
  • 149
  • 1
  • 14
3
votes
0 answers

How to feed a RDLC report with a custom IEnumerable grouped by

I want to reuse the same RDLC to display different tables depending on a format field. But my report does not show anything when the data source has the IEnumerable> return type already grouped. So if the users picks the…
diegosasw
  • 13,734
  • 16
  • 95
  • 159
3
votes
1 answer

c# and LINQ - convert IGrouping to List

I have the following code written to find common objects in a list of objects https://dotnetfiddle.net/gCgNBf .............................. var query = setOfPersons .SelectMany(l => l.Select(l1 => l1)) .GroupBy(p => p.Id) …
nidarshani fernando
  • 493
  • 4
  • 10
  • 26
3
votes
2 answers

Bind a SL4 TreeView to an IGrouping using Caliburn

I am just starting in the SL world and am trying to use the Caliburn NavigationShell as my starting point. I converted the solution to SL4 and use Caliburn from the trunk . To create the basic navigation, I am a bit unsure (well, quite), how I can…
Jan
  • 6,532
  • 9
  • 37
  • 48
2
votes
1 answer

ListView and IGrouping

I have a linq2sql query that results in an IGrouping, that I want to bind to a ListView:
TheDude
  • 197
  • 3
  • 10
2
votes
1 answer

Easiest way to convert IGrouping to IHierarchicalDataSource

I have a list of business objects that I want to display in a menu. I can quickly use LINQ to created nested groups to match the desired structure but have to manually iterate through each to instantiate and populate the menu items. I'm using the…
SonOfPirate
  • 5,642
  • 3
  • 41
  • 97
2
votes
3 answers

Nested IGrouping with LinQ

I want to know if it's possible to get a List>> out of a Linq expression. What I want to do is order songs by genre and artist, but in a format where I can iterate through each genre and for every genre,…
Jairo
  • 306
  • 3
  • 12
2
votes
1 answer

How to map an IGrouping to a IGrouping?

Given a function f:ValueA -> ValueB, how could I map an IGrouping of type IGrouping to IGrouping? Problem instance: Say you have this type: TaggedItem = { Tag:Tag ; Item:Item } and this query: query { for i in…
Lay González
  • 2,901
  • 21
  • 41
2
votes
2 answers

How in the Blank is this happening?

Having to do alot of stuff to get IGrouping Working in MVC4 c#. Below are my queries var a = (from r in db.SomeProcedure(Id) select new MyClass1 { Id= r.Id, …
user1307149
  • 1,427
  • 2
  • 16
  • 30
2
votes
1 answer

Retrieving all values from IGrouping

I currently have: UIEnumerable > From this code : var queryDupFiles = from file in fileList group file by new PortableKey { Name = file.Name, Length = file.Length } into g where g.Count() > 1 …
Emlinie
  • 117
  • 1
  • 3
  • 10
1
vote
2 answers

Get IGrouping data in Repeater ItemDataBound

I am wanting to group news articles by year in a repeater. The format would be: 2010 list of articles 2011 List of Articles My access layer returns a flat list of news articles, specifically List. Therefore, I am grouping them and binding them to…
gilpach
  • 1,367
  • 3
  • 16
  • 34
1
vote
2 answers

linq group by to generate nested POCO

I have four tables joined to produce data something like below: Name Grade CardID Date Class Listen Read Write Jane Doe A 1001 2020-10-01 Period 1 - Spanish 500 500 500 John Doe B+ …
AJSwift
  • 709
  • 4
  • 12
  • 26