Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Group by linq multiple columns C#

var query = (from t in Transactions
             group t by new {t.MaterialID, t.ProductID}
             into grp
                    select new
                    {
                        grp.Key.MaterialID,
                        grp.Key.ProductID,
                        Quantity = grp.Sum(t => t.Quantity)
                    }).ToList();
Comment

linq group by multiple

group x by new { x.Column1, x.Column2 }
Comment

linq group by multiple

.GroupBy(x => new { x.Column1, x.Column2 })
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity cast float to int 
Csharp :: data annotation c# name 
Csharp :: c# clear a textbox 
Csharp :: c# thread sleep vs task delay 
Csharp :: parse int in c# 
Csharp :: How to search for a string from readline in c# 
Csharp :: c# font bold set 
Csharp :: c# read text file separated by comma 
Csharp :: how to pause physics in unity c# 
Csharp :: define a vector c# 
Csharp :: wpf restart application c# 
Csharp :: c# datetime to timestamp 
Csharp :: c# array map 
Csharp :: how to use file watcher in c# 
Csharp :: how to convert nullable datetime datarow to datetime in c# 
Csharp :: how to add item to listbox in c# 
Csharp :: print random number unity 
Csharp :: get folders in directory c# 
Csharp :: unique items in list c# 
Csharp :: Find an item in a list by LINQ 
Csharp :: loop through string array c# 
Csharp :: how to add ground Check in unity 3d 
Csharp :: how to make a mouse down condition in C# 
Csharp :: c# list to array 
Csharp :: how to clone somthing unity 
Csharp :: forech unity 
Csharp :: implement custom string to datetime convert net core 
Csharp :: c# read file from directory 
Csharp :: how to install jdk on linux manjaro 
Csharp :: unity rotate direction by angle 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =