I am very confused.
I have this lambda expression:
tvPatientPrecriptionsEntities.Sort((p1, p2) =>
p1.MedicationStartDate
.Value
.CompareTo(p2.MedicationStartDate.Value));
Visual Studio will not compile it and complains about syntax.
I converted the lamba expression to an anonymous delegate as so:
tvPatientPrecriptionsEntities.Sort(
delegate(PatientPrecriptionsEntity p1, PatientPrecriptionsEntity p2)
{
return p1.MedicationStartDate
.Value
.CompareTo(p2.MedicationStartDate.Value);
});
and it works fine.
The project uses .NET 3.5 and I have a reference to System.Linq
.