Class ListExtensions
- Namespace
- Playnite
- Assembly
- Playnite.SDK.dll
Represents class with various extension methods for IEnumerable lists.
public static class ListExtensions
- Inheritance
-
ListExtensions
- Inherited Members
Methods
AddIfNotNull<T>(ICollection<T>, T?)
public static bool AddIfNotNull<T>(this ICollection<T> source, T? item)
Parameters
sourceICollection<T>itemT
Returns
Type Parameters
T
AddMissingBy<T>(IList<T>, T, Func<T, bool>)
public static bool AddMissingBy<T>(this IList<T> source, T item, Func<T, bool> predicate)
Parameters
Returns
Type Parameters
T
AddMissing<T>(IList<T>, IEnumerable<T>)
Adds new items to the list only if they are not already part of the list.
public static bool AddMissing<T>(this IList<T> source, IEnumerable<T> items)
Parameters
sourceIList<T>itemsIEnumerable<T>
Returns
- bool
True if an item was added, false if no item was added.
Type Parameters
T
AddMissing<T>(IList<T>, T)
Adds new item to the list only if it's not already part of the list.
public static bool AddMissing<T>(this IList<T> source, T item)
Parameters
sourceIList<T>itemT
Returns
- bool
True if item was added, false if it's already part of the list.
Type Parameters
T
AddRangeIfNotNull<T>(ICollection<T>, IEnumerable<T>?)
public static bool AddRangeIfNotNull<T>(this ICollection<T> source, IEnumerable<T>? items)
Parameters
sourceICollection<T>itemsIEnumerable<T>
Returns
Type Parameters
T
AddRange<T>(HashSet<T>, IEnumerable<T>?)
public static bool AddRange<T>(this HashSet<T> source, IEnumerable<T>? toAdd)
Parameters
sourceHashSet<T>toAddIEnumerable<T>
Returns
Type Parameters
T
ContainsPartOfString(IEnumerable<string>?, string, StringComparison)
Checks if source collection contains part of specified string.
public static bool ContainsPartOfString(this IEnumerable<string>? source, string value, StringComparison comparison = StringComparison.InvariantCultureIgnoreCase)
Parameters
sourceIEnumerable<string>valuestringcomparisonStringComparison
Returns
ContainsString(IEnumerable<string>?, string, StringComparison)
Checks if source collection contains specified string completely.
public static bool ContainsString(this IEnumerable<string>? source, string value, StringComparison comparison = StringComparison.InvariantCultureIgnoreCase)
Parameters
sourceIEnumerable<string>valuestringcomparisonStringComparison
Returns
ContainsStringPartial(IEnumerable<string>?, string, StringComparison)
Checks if part of specified string is part of the collection.
public static bool ContainsStringPartial(this IEnumerable<string>? source, string value, StringComparison comparison = StringComparison.InvariantCultureIgnoreCase)
Parameters
sourceIEnumerable<string>valuestringcomparisonStringComparison
Returns
Contains<T>(IList<T>?, IList<T>?)
Check if collection contains all items from other collection (in any order).
public static bool Contains<T>(this IList<T>? source, IList<T>? target)
Parameters
Returns
Type Parameters
T
EmptyIfNull<T>(IEnumerable<T>?)
public static IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T>? source)
Parameters
sourceIEnumerable<T>
Returns
- IEnumerable<T>
Type Parameters
T
FindIndex<T>(IList<T>, Predicate<T>)
public static int FindIndex<T>(this IList<T> source, Predicate<T> match)
Parameters
Returns
Type Parameters
T
ForEachAsync<T>(IEnumerable<T>?, Func<T, Task>)
public static Task ForEachAsync<T>(this IEnumerable<T>? source, Func<T, Task> action)
Parameters
sourceIEnumerable<T>actionFunc<T, Task>
Returns
Type Parameters
T
ForEach<T>(IEnumerable<T>?, Action<T>)
public static void ForEach<T>(this IEnumerable<T>? source, Action<T> action)
Parameters
sourceIEnumerable<T>actionAction<T>
Type Parameters
T
GetCommonItems<T>(IEnumerable<IEnumerable<T>>)
Gets items contained in all colletions.
public static HashSet<T> GetCommonItems<T>(IEnumerable<IEnumerable<T>> input)
Parameters
inputIEnumerable<IEnumerable<T>>
Returns
- HashSet<T>
Type Parameters
T
GetDistinctItemsP<T>(params IEnumerable<T>[])
Gets items distinct to all collections.
public static HashSet<T> GetDistinctItemsP<T>(params IEnumerable<T>[] lists) where T : notnull
Parameters
listsIEnumerable<T>[]
Returns
- HashSet<T>
Type Parameters
T
GetDistinctItems<T>(IEnumerable<IEnumerable<T>>)
Gets items distinct to all collections.
public static HashSet<T> GetDistinctItems<T>(IEnumerable<IEnumerable<T>> input) where T : notnull
Parameters
inputIEnumerable<IEnumerable<T>>
Returns
- HashSet<T>
Type Parameters
T
GetItems(ICollection)
public static List<object> GetItems(this ICollection source)
Parameters
sourceICollection
Returns
HasItems<T>(IEnumerable<T>?)
Check if collection has any items.
public static bool HasItems<T>(this IEnumerable<T>? source)
Parameters
sourceIEnumerable<T>
Returns
Type Parameters
T
HasItems<T>(IEnumerable<T>?, Func<T, bool>)
Check if collection has any items.
public static bool HasItems<T>(this IEnumerable<T>? source, Func<T, bool> predicate)
Parameters
sourceIEnumerable<T>predicateFunc<T, bool>
Returns
Type Parameters
T
HasNonEmptyItems(IEnumerable<string>?)
Checks if collection has any non-empty string items.
public static bool HasNonEmptyItems(this IEnumerable<string>? source)
Parameters
sourceIEnumerable<string>
Returns
IntersectsExactlyWith(IEnumerable<string>?, IEnumerable<string>?, StringComparison)
Checks if source collection contains any items from target one.
public static bool IntersectsExactlyWith(this IEnumerable<string>? source, IEnumerable<string>? target, StringComparison comparison = StringComparison.InvariantCultureIgnoreCase)
Parameters
sourceIEnumerable<string>targetIEnumerable<string>comparisonStringComparison
Returns
- bool
True if target collection contains items that are also part of source collection.
IntersectsPartiallyWith(IEnumerable<string>?, IEnumerable<string>?, StringComparison)
Checks if source collection contains any items from target one, even if just partially.
public static bool IntersectsPartiallyWith(this IEnumerable<string>? source, IEnumerable<string>? target, StringComparison comparison = StringComparison.InvariantCultureIgnoreCase)
Parameters
sourceIEnumerable<string>targetIEnumerable<string>comparisonStringComparison
Returns
- bool
True if target collection contains items that are also part of source collection.
IntersectsWith<T>(HashSet<T>?, HashSet<T>?)
public static bool IntersectsWith<T>(this HashSet<T>? source, HashSet<T>? target)
Parameters
Returns
Type Parameters
T
IsDictionaryEqual<TKey, TValue>(Dictionary<TKey, TValue>?, Dictionary<TKey, TValue>?)
public static bool IsDictionaryEqual<TKey, TValue>(this Dictionary<TKey, TValue>? source, Dictionary<TKey, TValue>? target) where TKey : notnull
Parameters
sourceDictionary<TKey, TValue>targetDictionary<TKey, TValue>
Returns
Type Parameters
TKeyTValue
IsHashSetEqual<T>(HashSet<T>?, HashSet<T>?)
public static bool IsHashSetEqual<T>(this HashSet<T>? source, HashSet<T>? target)
Parameters
Returns
Type Parameters
T
IsListEqualExact<T>(IList<T>?, IList<T>?)
Checks if two collections contain the same items in the same order.
public static bool IsListEqualExact<T>(this IList<T>? source, IList<T>? target)
Parameters
Returns
Type Parameters
T
IsListEqual<T>(IList<T>?, IList<T>?)
public static bool IsListEqual<T>(this IList<T>? source, IList<T>? target)
Parameters
Returns
Type Parameters
T
IsListEqual<T>(IList<T>?, IList<T>?, IEqualityComparer<T>)
Checks if two collections contain the same items in any order.
public static bool IsListEqual<T>(this IList<T>? source, IList<T>? target, IEqualityComparer<T> comparer)
Parameters
sourceIList<T>targetIList<T>comparerIEqualityComparer<T>
Returns
Type Parameters
T
Merge<T>(params HashSet<T>?[])
public static HashSet<T> Merge<T>(params HashSet<T>?[] lists)
Parameters
listsHashSet<T>[]
Returns
- HashSet<T>
Type Parameters
T
Merge<T>(IEnumerable<IEnumerable<T>>)
Merge collections together.
public static List<T> Merge<T>(IEnumerable<IEnumerable<T>> lists)
Parameters
listsIEnumerable<IEnumerable<T>>
Returns
- List<T>
Type Parameters
T
Merge<T>(IList<T>, IList<T>?)
Merge two collections together.
public static List<T> Merge<T>(IList<T> list1, IList<T>? list2)
Parameters
Returns
- List<T>
Type Parameters
T
RemoveIfNotNull<T>(ICollection<T>, T?)
public static bool RemoveIfNotNull<T>(this ICollection<T> source, T? item)
Parameters
sourceICollection<T>itemT
Returns
Type Parameters
T
Remove<T>(ICollection<T>, IEnumerable<T>)
public static void Remove<T>(this ICollection<T> source, IEnumerable<T> toRemove)
Parameters
sourceICollection<T>toRemoveIEnumerable<T>
Type Parameters
T
ToObservableCollection<T>(IEnumerable<T>)
public static ObservableCollection<T> ToObservableCollection<T>(this IEnumerable<T> source)
Parameters
sourceIEnumerable<T>
Returns
Type Parameters
T
TryGetItem<T>(IEnumerable<T>?, Func<T, bool>, out T?)
public static bool TryGetItem<T>(this IEnumerable<T>? source, Func<T, bool> predicate, out T? foundItem) where T : class
Parameters
sourceIEnumerable<T>predicateFunc<T, bool>foundItemT
Returns
Type Parameters
T