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
2 answers

VB.New How to Iterate LINQ Group with multiple groupings

I have spent hours looking through the archives here and on the web on how to iterate an IGroup that has multiple groupings for VB.Net. There are quite a few solutions for C# but I am really struggling to convert to VB.Net. Here is my List that I am…
scott_f
  • 838
  • 8
  • 17
0
votes
2 answers

Getting the Object From IGrouping in c#

I need to Access available Hotel Object From query2, here I am able to access HotelCode value using y.key, but How Can I Access the availableHotel Object from query2. My Matrix MOdel public class JsonMatrixModel { public…
Sirojan Gnanaretnam
  • 601
  • 1
  • 22
  • 45
0
votes
1 answer

Grouping by multiple fields in linq to sql

I'm having a problem of defining a data type for a list of grouped rows in LINQ to SQL. I have a model MyDBModel with 2 properties public class MyDBModel { public List a_Cases { get; set; } public List b_Cases { get;…
gg17
  • 139
  • 1
  • 2
  • 9
0
votes
1 answer

Igrouping does not find the right key for custom class

I have a custom class that contains 3 fields: public class Selector { public long? SubTypeID {get;set;} public int TypeID { get; set; } public DateTime? ActionDate { get; set; } } IEnumerable> query =…
safriss
  • 93
  • 2
  • 7
0
votes
1 answer

Grouping with strongly type group key in WPF

Every example and I article I found, is about grouping items by one property and displaying it. But what I have, is a strongly type group key, which I want to display. Here is models and grouping logic: The item interface public interface IItem { …
amiry jd
  • 27,021
  • 30
  • 116
  • 215
0
votes
0 answers

IQueryable in foreach - open DataReader error

When i run this code public PartialViewResult GetHardware() { IQueryable hardware = db.Hardwares; HardwareState hwState = new HardwareState(); IQueryable> groupByCategory =…
0
votes
2 answers

Check if IGrouping value contains result

I have an IGrouping structure IGrouping PingtreeNode contains a property of Response which in turn has a property Result. public class PingtreeNode { public ResponseAdapter Response { get; set;} //…
dotnetnoob
  • 10,783
  • 20
  • 57
  • 103
0
votes
0 answers

MVC 4 IEnumerable> to view

How to I get the grouped data to show up on my view? It wants to recieve a IEnumerable of the model but I'm passing grouped data. I'm returning this to the view in my controller: var slb = (from s in db.Tbl_Slb group s by…
R4VANG3R
  • 415
  • 1
  • 4
  • 11
0
votes
2 answers

List by GroupBy from IEnumerable

I am trying to create a list of Queues that are displayed by Queue Category. Each Queue Category is assigned an Enum value as such. public enum QueueCategory { None=0, Critical=1, High=2, Orphaned=3, Missing=4 } And for…
0
votes
1 answer

knockout foreach data bind on grouped data

I'm trying to figure out how to iterate through a .Net grouping using the knockout foreach data-bind. The issue I have is that I don't know how to iterate over a .Net collection of IGroupings once it's been serialized to JSON... On the server side…
james lewis
  • 2,486
  • 3
  • 24
  • 30
-1
votes
1 answer

Convert IGrouping to IQueryable in LINQ

if (model.ConnectedToOtherProfilesId != 0) { var fooGroup = fans.GroupBy(x => x.FanId) .Where(x => x.Any(z => z.ProfileId == model.ConnectedToOtherProfilesId)); var fooGroup2 = fooGroup.Where(grp => grp.Count()…
nightowl
  • 309
  • 1
  • 3
  • 13
-1
votes
3 answers

LINQ: No overload for method 'GroupBy' takes 6 arguments / IGrouping does not contain a definition

Problem: Getting error "No overload for method 'GroupBy' takes 6 arguments" A lot of the SO articles are for specific user created methods. GroupBy is part of the library. I've tried varying the number of arguments. If I change it to 2 arguments,…
seesharp
  • 101
  • 1
  • 14
-1
votes
1 answer

Foreach Nested Loop No Repetition

This is a very easy problem that I have been stuck on. I have a IEnumerable IGrouping object with grouped up common key items in it. I now need to compare each of the same common key item in the IEnumerable IGrouping object itself. I used 2 foreach…
user2672399
  • 185
  • 1
  • 10
-1
votes
1 answer

Why I don't get syntax error in this sample code?

Just trying some basics with C# Lookup collection and found, that this simple example compile fine, even IGrouping interface should have TElement set as int. string txt = "Hello world!"; ILookup occurrences = Enumerable.Range(0,…
Matěj Pokorný
  • 16,977
  • 5
  • 39
  • 48
-2
votes
3 answers

after group by in LINQ how to get to nested values using select

http://img51.imageshack.us/i/linqquestion.png/ Everything is in the picture. I just want to get to one of the highlighted values, for example size. code from picture : var queryGroupDuplicates = from dlc in listDLC …
Przemysław Banaszek
  • 838
  • 2
  • 11
  • 17