class user
{
public string userID { get; set; }
public string groupID { get; set; }
public int individualCredit { get; set; }
public int groupCredit { get; set; }
}
I have a list like this
List<user> listUsers = new List<user>();
I want to group users with same
groupID
.Calculate
groupCredit
by adding theindividualcredit
s of each member in group and by dividing it by the number of group members.Finally I want to assign each user with their
groupCredit
.
There are groups with three to five members.
How to do that?
Here's what I have tried.
var groupedUsers = from users in listUsers
where users.groupID != ""
group users by users.groupID into grouphold
select grouphold ;
Here's what I don't know.
How to search for the same groupID
? In what I have tried I check for all Items groupID
is blank.