I am having trouble shuffling a list based on one property in my class. My SCHEDULE
class contains two properties: sEmployeeID
and sStationID
I populate the list as follows, but I would like to shuffle by ID_STATION
and have something different at every run.
List<SCHEDULE> scheduleList = new List<SCHEDULE>();
foreach (DataRow row2 in tschedule.Rows)
{
sEmployeeID = row2["ID_EMPLOYEE"].ToString();
sStationID = row2["ID_STATION"].ToString();
scheduleList.Add(new SCHEDULE(sEmployeeID, sStationID));
}
Actually I would like to get my ID_STATION items change rows while my ID_EMPLOYEEs will stay at their original positions. Example: From this,
ID_EMPLOYEE ID_STATION
ALAD DECH
FRED DECI
MIKE ORR
PAM OR
RAK ORW
RAYN PROC
I would like to have this:
ID_EMPLOYEE ID_STATION
ALAD ORW
FRED PROC
MIKE DECI
PAM DECH
RAK OR
RAYN ORR