I am trying to get the first and last values in a list. The query operator First() is supported but Last() and LastOrDefault() give an
First()
Last()
LastOrDefault()
either you switch your OrderBy to
.OrderByDescending(p => p.BillID)
(and use first) or you do something like
purchaseBills.ToArray().Last()
if this is not to expensive.