Last vs LastOrDefault in LINQ
S.No | Last | LastOrDefaulf |
1 | Last extension method gives last element from the collection. If there is no element in the collection, it throws error. | LastOrDefault extension method gives the last element form the collection, if not gives null. |