score:2
Accepted answer
for your output
test list, you can get themax
of dead_alive
and blocked_unblocked
after grouping, like the following code:
var groups = output.groupby(x => x.id_number)
.select(y => new cls_entry
{
id_number = y.key,
dead_alive = y.max(e => e.dead_alive),
blocked_unblocked = y.max(e => e.blocked_unblocked)
}).tolist();
documentation of max
method : max
Source: stackoverflow.com
Related Query
- Group and Merge multiple values from single List using LINQ
- Group by key and send values into list using LINQ
- Using Linq to group by multiple columns in a list and mark all duplicate items
- How should i use group by and sum on different values of list of models using linq
- C# - How to achieve multiple matching from a single string by using Linq and Regex?
- Linq group by multiple columns and getting extra values from table before group by clause
- Using LINQ and EF, how to remove values from database where not in list of items
- How to extract values from a list of dictionaries and group and convert to a single dictionary with Linq?
- How to get lists of X and Y from a list of points using a single linq query?
- How could I create single list from Parent and child node from XML using Linq
- C# Linq Group elements from list and count sum of values
- How to dynamically group a list and select values using linq query in C#?
- LINQ: join multiple Table Column using Linq and find aggregated sum from child table values
- LINQ conditional select from table and return multiple column as a single list
- Retrieve a list of IDs and Values from XML using Linq
- C# Linq Comparing List Values using multiple fields and return item which doesn't satisfy the condition
- Using linq to group by and merge property values of duplicates
- c# Linq or code to extract groups from a single list of source data
- Using Linq First Group particular Column value and then Make Avg of values from second column
- How to select values within a provided index range from a List using LINQ
- How to select multiple values from a Dictionary using Linq as simple as possible
- Get indexes of all matching values from list using Linq
- Using LINQ to group by multiple properties and sum
- Select distinct values from a list using LINQ in C#
- How do I remove items from generic list, based on multiple conditions and using linq
- Convert a list to a dictionary and sum up values using linq
- Assign values from one list to another using LINQ
- Match and update values using linq from two lists?
- Using Linq and C#, trying to get two lists from a list of master items grouped by two inner lists
- How to use Linq to select and group complex child object from a parents list
More Query from same tag
- How to declare a Linq Expression variable in order to have it processed as a dbParameter
- How to select highest common value across groups
- Entity Framework ThenInclude filtered from original dataset
- Entity Framework many to many retrieval data with LINQ
- How Do You Sort Items By Set in LINQ?
- Dynamic clause where in Linq to Datatable
- Adding to Lambda Expression and work with Entity Framework
- sql server to linq group by having
- Entity Framework 4.0 only include some related data
- DataTable Query
- Split a list of items with generic parameters into separate lists of each generic type
- Left join two datatables asp net c# LINQ
- Parallel Linq: Ordered treatment
- System.FormatException: String was not recognized as a valid DateTime
- Where to find translated Linq to Entity query to Sql
- Unique list of items using LINQ
- Umbraco 7: change sort order for Blog Overview in Starter Kit
- Remove non unique objects between two lists C#
- How do you convert SQL to LINQ
- PostgreSQL, Linq C# error 'could not determine data type of parameter $1'
- Convert IQueryable to IOrderedQueryable
- check whether the list contains item greater than a value in C#
- Trying to Mock IQueryable Entity Framework Query
- LINQ on loop conditions
- Join Expression<Func<T,bool>>
- Creating database using DataContext and System.Data.SQLite in C#
- How to Serialize a Control to JSON?
- How to Parameterize Linq Query or Lambda Query in Entity Framework?
- How to split a list into 2 separate list based on a filed in the parent list with linq
- Filtering this Linq query