score:2
Accepted answer
You can return distinct values of the Platform
collection by using Enumerable.Distinct()
.
The Platforms
value in the result selector in your .GroupBy()
operation should be computed as follows:
Platforms = g.Select(p => p.Platform).Distinct().ToList()
score:0
Maybe you could try something like this:
var group = recordList.GroupBy(r => r.Article)
.Select(a =>
new
{
Article = a.Key,
Platforms = a.GroupBy(g => g.Platform)
});
Source: stackoverflow.com
Related Articles
- How to use LINQ Group Records and use Distinct
- linq distinct or group by multiple properties
- How to use distinct with group by in Linq to SQL
- LINQ Source Code Available
- Distinct with group by in Linq
- C# LINQ query (MYSQL EF) - Distinct and Latest Records
- how do I write LINQ query to retrieve distinct records based on only specific properties?
- Group by Distinct using Linq
- LINQ In Clause With Group By And TOP N Records Within Each Group
- Selecting distinct records in a declarative linq data source?
- LINQ Select newest records that have distinct ForeignKeyId column
- Linq to SQL get distinct records grouped by date
- C# LINQ get records from datatable group by hour
- IEqualityComparer and Linq Distinct - Hard Code GetHashCode()
- selecting repeated values from distinct group using LINQ
- Linq Query to Get Distinct Records from Two Tables
- creating Linq to sqlite dbml from DbLinq source code
- Select all distinct last records of column1 and order by column2 in Linq (Not Working Accordingly)
- LINQ to SQL group by shows wrong count of distinct foreign key
- how to use group by in linq C# and fetch the list of records
- LINQ query to group records by month within a period
- How to write an linq statement to get the last of a group of records
- LINQ Checking all Records in Group
- linq Group By and take first and lats records
- GroupBy using LINQ but base distinct on another column, and still be able to count other records
- How return distinct records using LINQ
- LINQ group by ID - Distinct by order
- get ID of latest records in a group by linq query
- How to Select top (5) contributors group by Business type code in c# linq query
- LINQ for getting the 5 latest records for each distinct name
- How can I convert SQL to lambda expressions
- LINQ to XML recursively remove elements - C#
- Custom object using Except failing to use IEqualityComparer<T>
- how to write linq to sql with lambda for this sql query
- Extension for Umbraco /base
- compare two identical lists of strings
- How to order group results in linq
- Can you Sum() more than one value in a single linq statement...without grouping?
- ASP.NET search form - dynamic Linq to SQL?
- Retrieving a subset of rows from an OData endpoint
- Anonymous Type Appears in both Error
- Create a sliding window from a list
- Computational and stylistic optimal solution for the conditional where clause using Linq
- Building a dynamic anonymous type Select statement using Linq
- C# WPF delete item with its primary key from database using datagrid
- Hierarchical Update
- Linq to SQL - Exact Relational Division
- LINQ to Datatable Group by and return all columns
- SQL to LINQ Conversion having an XPath Query
- Why am I not getting .CopyToDataTable() in Linq Query()