Skip to main content

All Questions

Tagged with
1 vote
4 answers
47 views

Apply Group by to dictionary value

I have a Dictionary which key of string type and value of list of integer type, like this: Dictionary<string, List<int>>. Lets say I add elements to it: Dictionary<string, List<int&...
sst's user avatar
  • 23
-3 votes
1 answer
56 views

Group List by property

I have a List of purchases that looks something like this: List<MyItem> l = new List<MyItem>(); l.Add(new MyItem(){person_id = 1, person_name = "Jim", shirt = "green", ...
TheIronCheek's user avatar
  • 1,127
0 votes
2 answers
133 views

LINQ group a list and exclude groups that contain a record with a field value

Having trouble setting up my lamda to exlude groups with a record that has a field with a value. My data example: CTY ProcId ProcTyp ProcDate ZZZ 23-015 INIT 2023-01-26T20:04:30 ZZZ 23-015 UPDATE ...
sinDizzy's user avatar
  • 1,324
1 vote
1 answer
55 views

How to find duplicates in a LINQ Group collection

I want to write a LINQ query that will check whether there is duplication of User data in my InfoObject objects. In the succeeding illustration, I want to group by Code (i.e., XYZ) and check whether ...
Mark U's user avatar
  • 545
2 votes
1 answer
37 views

C# Datable grouped by two fields, putting 4 field into an array

I have a XLSX file that has 4 columns (id, form name, data, imagepath). My end goal is to group all these rows into concise groupings based on id and form name with an array of docs per form. |ID ...
shhh-bacon's user avatar
2 votes
1 answer
244 views

C# Linq GroupBy Return Default Value Instead Of Null

I have the following list. I'm trying to split it into odd & even lists using GroupBy: var x = new int[] { 2, 4, 6, 8, 10 }; var y = x .GroupBy(x => x % 2 == 0) .Select(x => x.ToList()) ...
Preem Palver2's user avatar
1 vote
1 answer
126 views

How can I group by using the first character of the Last Name using LINQ?

I am trying to answer this question for class and I am having a bit of trouble understanding why things do and don't work. The inquiry I have is about the use of LINQ and group by. This is the ...
Cutty's user avatar
  • 11
0 votes
1 answer
154 views

GroupBy not working in .NET Core - same count in original and grouped list

I'm working on project in .NET Core 3.1, but the version is not relevant for this question because I have a problem with group by with simple examples. My original query is long, so when I was in ...
Lazar Đor��ević's user avatar
1 vote
2 answers
127 views

LINQ - How to group by name from nested array

_id:"63624b321e78f38a3d6baf3e" Taxes [0] TaxName:CGST Amount:9.0 [1] TaxName:SGST Amount:8.0 _id:"63624b321e78f38a3d6baf3e" Taxes [1] TaxName:SGST Amount:8.0 I need to ...
Anjana Padmesh's user avatar
0 votes
3 answers
52 views

Linq group by condition

I provide the simple list as below : var records = new List<BookRecord> { new() { Author = "Peter", BookName = "Book A" ...
Carrie Kaski's user avatar
0 votes
3 answers
254 views

How to use linq to group a list of strings on only certain strings

example list of strings: var test = new List<string>{ "hdr1","abc","def","ghi","hdr2","lmn","opq","hdr3","...
oden's user avatar
  • 3
-1 votes
1 answer
618 views

EF Core Linq query with grouping: Why does DefaultIfEmpty() not work here?

I have two tables that I'm trying to group with the EF Core equivalent of a Left Join. Table "Orders" lists the total amount of orders placed for a given item in each month of the year: ...
bmurrell30's user avatar
-1 votes
1 answer
412 views

C# Group the objects of list by property

I'm very new to C# and bad at explaining, hope the given input and output data will help. I have a JSON file that contains pairs of strings which are keys use to identify something. Each key can be ...
Rohan Nirer's user avatar
2 votes
1 answer
247 views

Isolate duplicate objects in a list of objects

Given a list of objects with possible duplicates, I can find plenty of examples of how to get a List<IGrouping<'a, MyObject>> or how to remove duplicates. But what I want to do is just ...
Casey Crookston's user avatar
0 votes
1 answer
97 views

LINQ query grouping without duplication of data

So I want to display an output that is group by two fields: SubsidiaryCode and AssetCreatedDate. My problem is it displays the grouping values redundantly. I suspect it duplicates because of my Detail ...
Its_Me's user avatar
  • 57

15 30 50 per page
1
2 3 4 5
20