score:7
Accepted answer
from p in names
group p by p.name into g
order by g.key
select new { name = g.key, amount = g.sum(o => o.amount) }
score:8
var personmoney = names.groupby(x=>x.name)
.select(x=>new {name = x.key, allmoney = x.sum(y=>y.money)})
.orderbydescending(x=>x.allmoney).tolist();
Source: stackoverflow.com
Related Query
- LINQ Source Code Available
- creating Linq to sqlite dbml from DbLinq source code
- How to Select top (5) contributors group by Business type code in c# linq query
- source code for LINQ 101 samples
- c# Linq or code to extract groups from a single list of source data
- Group by in LINQ
- C# Linq Group By on multiple columns
- Convert string[] to int[] in one line of code using LINQ
- LINQ Group By into a Dictionary Object
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- Using Linq to group a list of objects into a new grouped list of list of objects
- LINQ - Left Join, Group By, and Count
- How to get first record in each group using Linq
- Linq with group by having count
- Linq code to select one item
- How do I get the MAX row with a GROUP BY in LINQ query?
- LINQ Group By and select collection
- Linq order by, group by and order by each group?
- Linq Query Group By and Selecting First Items
- LINQ Group By Multiple fields -Syntax help
- LINQ to SQL using GROUP BY and COUNT(DISTINCT)
- How are people unit testing code that uses Linq to SQL
- Group Multiple Tables in LINQ
- LINQ group by expression syntax
- LINQ aggregate and group by periods of time
- linq distinct or group by multiple properties
- Group by Weeks in LINQ to Entities
- Linq - Top value from each group
- Nested Group by LINQ
- Counting Using Group By Linq
More Query from same tag
- Linq Query On IDictionaryEnumerator Possible?
- Angular 4 | Error in production ng2-linq
- LINQ, Join, Group By and SUM
- How way to operate on single items at an index in group in IGrouping?
- distinct in the two list
- Sort a Query of multi-rows in a row with Linq
- Linq min date max date model querying
- Need a LINQ code example to link two tables that have no foreign key
- LINQ "zip" in String Array
- Iterating DataView for Update
- Why does DbFunctions not work with Linq to Entities
- how to get data to datatable using linq
- how to take and skip records using TSQL instead of linq
- Update all objects in a collection using LINQ
- SQL query with grouping and join into LINQ
- Using select distinct on DataTable
- ObjectDisposedException despite *Include* being used
- Join sub query table to table function with outer apply using Entity Framework
- How can I compare two Lists and create another list where the match?
- C# using LINQ, from a list of objects, create a new list of objects, removing ones whose property is in a list of stings
- how to count two seperate where condition linq
- return string[] from LINQ IQueryable object?
- Split string with LINQ
- How to sort this Dictionary
- linq to xml: how to select the value from elements
- Linq compare hour
- List of inherited classes with mixed properties
- Error Checking using Func Delegate
- Linq - filter a child list<object> without affecting Parent row count
- How to find specific Elements in Lists which are part of Lists