I have an IEnumerable<MyData> that contains the following data
Fruits | Name | Quantity | __________________________ Mango | Jay | 10 | __________________________ Apple | Jay | 16 | __________________________ Grapes| Jay | 12 | __________________________ Mango | Raj | 11 | __________________________ Apple | Raj | 20 | __________________________ Grapes| Raj | 3 | __________________________ Mango | Vik | 20 | __________________________ Apple | Vik | 15 | __________________________
I need to select from the top two lines of Linq according to type name
Jay (10+16+12) = 38 Raj (11+20+3) = 34 Vik (20+15) = 35
Jay and Vik have the top two sums, so I need these records
Fruits | Name | Quantity | __________________________ Mango | Jay | 10 | __________________________ Apple | Jay | 16 | __________________________ Grapes| Jay | 12 | __________________________ Mango | Vik | 20 | __________________________ Apple | Vik | 15 | __________________________
c # linq
Govind KamalaPrakash Malviya
source share