Hi
I have below code & i want only distinct records in StudentCollection.
List objResult = bALSessionDeliveryParticipant.GetSessionDeliveryParticipantList(Convert.ToDateTime("2020-01-01"), Utility.CurrentDateTime(), MentorCollection, GroupCollection);
if (objResult != null)
{
foreach (var colum in objResult)
{
StudentCollection.Add(colum.StudentID.ToString());
}
}
Thanks
Amit MohantyPosted May 29, 2023, 5:39 AM
try this:
Aravind GovindarajPosted May 28, 2023, 5:49 PM
Hi Ramco,
you could get the desired result in a couple of approaches
1. you can get a distinct result from the backend in the get method (bALSessionDeliveryParticipant.GetSessionDeliveryParticipantList)
2. Before adding to StudentCollection, please check if the student id already exists in the collection.
if ! (StudentCollection.Any(x=>x.StudentId == column.StudentID)
{
StudentCollection.Add(colum.StudentID.ToString());
}