Extensions for enumerable sources
InheritanceSystem.Object
Namespace: Umbraco.Extensions Assembly: Umbraco.Core.dll Syntaxpublic static class EnumerableExtensions
Methods View Source ContainsAll<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)
Returns true if all items in the other collection exist in this collection
Declarationpublic static bool ContainsAll<TSource>(this IEnumerable<TSource> source, IEnumerable<TSource> other)
Parameters Type Name Description IEnumerable<TSource> source IEnumerable<TSource> other Returns Type Description System.Boolean Type Parameters View Source ContainsAny<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)
Returns true if the source contains any of the items in the other list
Declarationpublic static bool ContainsAny<TSource>(this IEnumerable<TSource> source, IEnumerable<TSource> other)
Parameters Type Name Description IEnumerable<TSource> source IEnumerable<TSource> other Returns Type Description System.Boolean Type Parameters View Source EmptyNull<T>(Nullable<IEnumerable<T>>)
Gets a null IEnumerable as an empty IEnumerable.
Declarationpublic static IEnumerable<T> EmptyNull<T>(this IEnumerable<T>? items)
Parameters Type Name Description System.Nullable<IEnumerable<T>> items Returns Type Description IEnumerable<T> Type Parameters View Source FindIndex<T>(IEnumerable<T>, Func<T, Boolean>)
Finds the index of the first item matching an expression in an enumerable.
Declarationpublic static int FindIndex<T>(this IEnumerable<T> items, Func<T, bool> predicate)
Parameters Type Name Description IEnumerable<T> items
The enumerable to search.
Func<T, System.Boolean> predicateThe expression to test the items against.
Returns Type Description System.Int32The index of the first matching item, or -1.
Type Parameters Name Description TThe type of the enumerated objects.
View Source FindIndex<T>(IEnumerable<T>, Int32, Func<T, Boolean>)Finds the index of the first item matching an expression in an enumerable.
Declarationpublic static int FindIndex<T>(this IEnumerable<T> items, int startIndex, Func<T, bool> predicate)
Parameters Type Name Description IEnumerable<T> items
The enumerable to search.
System.Int32 startIndexThe index to start at.
Func<T, System.Boolean> predicateThe expression to test the items against.
Returns Type Description System.Int32The index of the first matching item, or -1.
Type Parameters Name Description TThe type of the enumerated objects.
View Source ForAllThatAre<TBase, TActual>(IEnumerable<TBase>, Action<TActual>) Declarationpublic static IEnumerable<TBase> ForAllThatAre<TBase, TActual>(this IEnumerable<TBase> sequence, Action<TActual> projection)
where TActual : class
Parameters Type Name Description IEnumerable<TBase> sequence Action<TActual> projection Returns Type Description IEnumerable<TBase> Type Parameters Name Description TBase TActual View Source IfNotNull<TItem>(IEnumerable<TItem>, Action<TItem>)
The if not null.
Declarationpublic static void IfNotNull<TItem>(this IEnumerable<TItem> items, Action<TItem> action)
where TItem : class
Parameters Type Name Description IEnumerable<TItem> items
The items.
Action<TItem> actionThe action.
Type Parameters Name Description TItemThe type
View Source IndexOf<T>(IEnumerable<T>, T)Finds the index of the first occurrence of an item in an enumerable.
Declarationpublic static int IndexOf<T>(this IEnumerable<T> items, T item)
Parameters Type Name Description IEnumerable<T> items
The enumerable to search.
T itemThe item to find.
Returns Type Description System.Int32The index of the first matching item, or -1 if the item was not found.
Type Parameters View Source InGroupsOf<T>(Nullable<IEnumerable<T>>, Int32) Declarationpublic static IEnumerable<IEnumerable<T>> InGroupsOf<T>(this IEnumerable<T>? source, int groupSize)
Parameters Type Name Description System.Nullable<IEnumerable<T>> source System.Int32 groupSize Returns Type Description IEnumerable<IEnumerable<T>> Type Parameters View Source IsCollectionEmpty<T>(Nullable<IReadOnlyCollection<T>>) Declaration
public static bool IsCollectionEmpty<T>(this IReadOnlyCollection<T>? list)
Parameters Type Name Description System.Nullable<IReadOnlyCollection<T>> list Returns Type Description System.Boolean Type Parameters View Source OfTypes<T>(IEnumerable<T>, Type[]) Declaration
public static IEnumerable<T> OfTypes<T>(this IEnumerable<T> contents, params Type[] types)
Parameters Type Name Description IEnumerable<T> contents Type[] types Returns Type Description IEnumerable<T> Type Parameters View Source OrderBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>, Direction) Declaration
public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Direction sortOrder)
Parameters Type Name Description IEnumerable<TSource> source Func<TSource, TKey> keySelector Direction sortOrder Returns Type Description IOrderedEnumerable<TSource> Type Parameters Name Description TSource TKey View Source Range<T>(Func<Int32, T>, Int32)
Returns a sequence of length count
whose elements are the result of invoking factory
.
public static IEnumerable<T> Range<T>(Func<int, T> factory, int count)
Parameters Type Name Description Func<System.Int32, T> factory
The factory.
System.Int32 countThe count.
Returns Type Description IEnumerable<T> Type Parameters View Source RemoveAll<T>(ICollection<T>, Func<T, Boolean>)Removes all matching items from an .
Declarationpublic static void RemoveAll<T>(this ICollection<T> list, Func<T, bool> predicate)
Parameters Type Name Description ICollection<T> list
The list.
Func<T, System.Boolean> predicateThe predicate.
Type Parameters View Source RemoveAll<T>(IList<T>, Func<T, Boolean>)Removes all matching items from an .
Declarationpublic static void RemoveAll<T>(this IList<T> list, Func<T, bool> predicate)
Parameters Type Name Description IList<T> list
The list.
Func<T, System.Boolean> predicateThe predicate.
Type Parameters View Source SelectByGroups<TResult, TSource>(IEnumerable<TSource>, Func<IEnumerable<TSource>, IEnumerable<TResult>>, Int32) Declarationpublic static IEnumerable<TResult> SelectByGroups<TResult, TSource>(this IEnumerable<TSource> source, Func<IEnumerable<TSource>, IEnumerable<TResult>> selector, int groupSize)
Parameters Type Name Description IEnumerable<TSource> source Func<IEnumerable<TSource>, IEnumerable<TResult>> selector System.Int32 groupSize Returns Type Description IEnumerable<TResult> Type Parameters Name Description TResult TSource View Source SelectRecursive<TSource>(IEnumerable<TSource>, Func<TSource, IEnumerable<TSource>>, Int32) Declaration
public static IEnumerable<TSource> SelectRecursive<TSource>(this IEnumerable<TSource> source, Func<TSource, IEnumerable<TSource>> recursiveSelector, int maxRecusionDepth = 100)
Parameters Type Name Description IEnumerable<TSource> source Func<TSource, IEnumerable<TSource>> recursiveSelector System.Int32 maxRecusionDepth Returns Type Description IEnumerable<TSource> Type Parameters View Source SkipLast<T>(IEnumerable<T>) Declaration
public static IEnumerable<T> SkipLast<T>(this IEnumerable<T> source)
Parameters Type Name Description IEnumerable<T> source Returns Type Description IEnumerable<T> Type Parameters View Source Transform<TSource, TTarget>(IEnumerable<TSource>, Func<IEnumerable<TSource>, IEnumerable<TTarget>>)
Transforms an enumerable.
Declarationpublic static IEnumerable<TTarget> Transform<TSource, TTarget>(this IEnumerable<TSource> source, Func<IEnumerable<TSource>, IEnumerable<TTarget>> transform)
Parameters Type Name Description IEnumerable<TSource> source Func<IEnumerable<TSource>, IEnumerable<TTarget>> transform Returns Type Description IEnumerable<TTarget> Type Parameters Name Description TSource TTarget View Source UnsortedSequenceEqual<T>(Nullable<IEnumerable<T>>, Nullable<IEnumerable<T>>)
Determines if 2 lists have equal elements within them regardless of how they are sorted
Declarationpublic static bool UnsortedSequenceEqual<T>(this IEnumerable<T>? source, IEnumerable<T>? other)
Parameters Type Name Description System.Nullable<IEnumerable<T>> source System.Nullable<IEnumerable<T>> other Returns Type Description System.Boolean Type Parameters View Source WhereNotNull<T>(IEnumerable<T>)
Filters a sequence of values to ignore those which are null.
Declarationpublic static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T> coll)
where T : class
Parameters Type Name Description IEnumerable<T> coll
The coll.
Returns Type Description IEnumerable<T> Type Parameters View Source Yield<T>(T)Wraps this object instance into an IEnumerable{T} consisting of a single item.
Declarationpublic static IEnumerable<T> Yield<T>(this T item)
Parameters Type Name Description T item
The instance that will be wrapped.
Returns Type Description IEnumerable<T>An IEnumerable{T} consisting of a single item.
Type Parameters Name Description TType of the object.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4