Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
In Umbraco 7, I used the extensions for isFirst() and isLast() extensively. They're apparently gone in U8. Is there an easy way that doesn't require 10 lines of code to get these functions back?
Just add these extensions to your project
public static class IEnumerableExtensions
public static bool IsLast<T>(this IEnumerable<T> items, T item)
var last = items.LastOrDefault();
if (last == null)
return item.Equals(last); // OR Object.ReferenceEquals(last, item)
public static bool IsFirst<T>(this IEnumerable<T> items, T item)
var first = items.FirstOrDefault();
if (first == null)
That’s super helpful, thanks!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted