示例#1
0
        public static int IndexOf <T>([NotNull] this IEnumerable <T> collection, [NotNull] T item, [NotNull] IEqualityComparer <T> comparer)
        {
            collection = collection.ArgumentItemsExists();
            item       = item.ArgumentNotNull();
            comparer   = comparer.ArgumentNotNull();

            return(collection.Select((x, index) => comparer.Equals(item, x) ? index : -1).FirstOrDefault(x => x != -1, -1));
        }