Click here to Skip to main content
15,900,461 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
foreach (var cell in group.Cells)
{
                                    
}

id,label and status values are stored in local variable cell.
C#
cell.label;
cell.id;
cell.Sectors;

How Group by status in LINQ?
Posted
Comments
Maciej Los 24-Mar-15 2:41am    
Where do you see "Status" field? What is a cell: DataGridViewCell, DataTable.Cell, Excel.Cell?
You need to be more specific if you want to get an answer.
King Fisher 24-Mar-15 2:50am    
not clear.

1 solution

Your question is not clear, so we can;t help you directly...

Have a look here: LINQ - Grouping Operators[^]

[EDIT]
It might look like:
C#
var qry = cells.GroupBy(x=>x.Status).Select(grp=>new{Status=grp.Key, Name = grp.Key.Name, Value=grp.Sum(z=>z.Value)});

[/EDIT]
 
Share this answer
 
v2
Comments
Rnshanmugavadivel 24-Mar-15 2:50am    
Cells information are stored in local variable "cell" every cell have id and name..
Now i want group by cell Status(status means True/False) based on id and name..
BillWoodruff 24-Mar-15 5:05am    
Maciej, I think you are wasting your time posting "good code" when the OP has provided so little information.
Maciej Los 24-Mar-15 11:17am    
;) i can devote 30s. ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900