My class
class student
{
public string studentid { get; set; }
public string groupid { get; set; }//Group id
}
My List
List<student> pupils = new List<student>();
here I select students with no group ID. I have assigned students with no group ID as ="00"
var studentWithNogroupID = from student in pupils where student.groupid == "00" select student;
I have an integer which I'm gonna increase each time and convert to char and assign each student.
int groupid=001;
string grid = myInt.ToString(groupid);
Here I'm assigning each member with group id like this..
foreach(var student in studentsWithNoGroupId)
{
student.groupid = "grid";
}
My problem is I have to assign three members to a group. In other words 3 members should have same group id. And after each 3 members it should increase the group id which is like this to create a new group id.
groupid+=1;
How to go three by three in for loop or can anyone provide me a solution to assign three students to a group.