Hope this is a simple question when I do not understand something basic. Below are two Linq statements from the application I'm working on.
EDMXModel.Classes.Period p1 = entities.Periods.DefaultIfEmpty(null).OrderByDescending(ap => ap.UID).First(); EDMXModel.Classes.Period p2 = entities.Periods.OrderByDescending(ap => ap.UID).DefaultIfEmpty(null).First();
entity.Periods is a collection containing two Period objects, each with a unique UID
.
According to everything that I understand, p1 and p2 should be the same.
In my environment, however, this is not the case.
p1 is correct (i.e., it is equal to the Period object with the largest UID in the set).
p2, however, is incorrect (i.e., it is equal to another period in the set).
Any ideas?
source share