How to simplify existing method using Lambda Expression

  • Thread starter Thread starter Jeff0803
  • Start date Start date
J

Jeff0803

Guest
I have a method which return a bool value found from patientlist's item found by patientid.

Here is the code.

public bool GetAvoidReminder(long patientid, List<Patient> patientlist)
{
foreach (Patient patient in patientlist)
{
if (patient.PatientID == patientid)
{
return (patient.AvoidReminder);
}
}
return (false);
}


Calling part is like following.

bool bret = GetAvoidReminder(patientid, patientlist);

I'd like to simplify these code using Lambda Expression or other way.

Can anybody give me any advice?

Continue reading...
 
Back
Top