Class ListExtensions
- Namespace
- System.Collections.Generic
- Assembly
- Playnite.SDK.dll
Represents class with various extension methods for IEnumerable lists.
public static class ListExtensions
- Inheritance
-
ListExtensions
- Inherited Members
Methods
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
source
IList<T>items
IEnumerable<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
source
IList<T>item
T
Returns
- bool
True if item was added, false if it's already part of the list.
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
source
IEnumerable<string>value
stringcomparison
StringComparison
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
source
IEnumerable<string>value
stringcomparison
StringComparison
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
source
IEnumerable<string>value
stringcomparison
StringComparison
Returns
Contains<T>(IEnumerable<T>, IEnumerable<T>)
Check if collection contains all items from other collection (in any order).
public static bool Contains<T>(this IEnumerable<T> source, IEnumerable<T> target)
Parameters
source
IEnumerable<T>target
IEnumerable<T>
Returns
Type Parameters
T
ForEach<T>(IEnumerable<T>, Action<T>)
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
Parameters
source
IEnumerable<T>action
Action<T>
Type Parameters
T
ForEach<T>(ObservableCollection<T>, Action<T>)
public static void ForEach<T>(this ObservableCollection<T> source, Action<T> action)
Parameters
source
ObservableCollection<T>action
Action<T>
Type Parameters
T
GetCommonItems<T>(IEnumerable<IEnumerable<T>>)
Gets items contained in all colletions.
public static HashSet<T> GetCommonItems<T>(IEnumerable<IEnumerable<T>> lists)
Parameters
lists
IEnumerable<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)
Parameters
lists
IEnumerable<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>> lists)
Parameters
lists
IEnumerable<IEnumerable<T>>
Returns
- HashSet<T>
Type Parameters
T
HasItems<T>(IEnumerable<T>)
Check if collection has any items.
public static bool HasItems<T>(this IEnumerable<T> source)
Parameters
source
IEnumerable<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
source
IEnumerable<T>predicate
Func<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
source
IEnumerable<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
source
IEnumerable<string>target
IEnumerable<string>comparison
StringComparison
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
source
IEnumerable<string>target
IEnumerable<string>comparison
StringComparison
Returns
- bool
True if target collection contains items that are also part of source collection.
IsListEqualExact<T>(IEnumerable<T>, IEnumerable<T>)
Checks if two collections contain the same items in the same order.
public static bool IsListEqualExact<T>(this IEnumerable<T> source, IEnumerable<T> target)
Parameters
source
IEnumerable<T>target
IEnumerable<T>
Returns
Type Parameters
T
IsListEqual<T>(IEnumerable<T>, IEnumerable<T>)
Checks if two collections contain the same items in any order.
public static bool IsListEqual<T>(this IEnumerable<T> source, IEnumerable<T> target)
Parameters
source
IEnumerable<T>target
IEnumerable<T>
Returns
Type Parameters
T
IsListEqual<T>(IEnumerable<T>, IEnumerable<T>, IEqualityComparer<T>)
Checks if two collections contain the same items in any order.
public static bool IsListEqual<T>(this IEnumerable<T> source, IEnumerable<T> target, IEqualityComparer<T> comparer)
Parameters
source
IEnumerable<T>target
IEnumerable<T>comparer
IEqualityComparer<T>
Returns
Type Parameters
T
Merge<T>(IEnumerable<IEnumerable<T>>)
Merge collections together.
public static List<T> Merge<T>(IEnumerable<IEnumerable<T>> lists)
Parameters
lists
IEnumerable<IEnumerable<T>>
Returns
- List<T>
Type Parameters
T
Merge<T>(IEnumerable<T>, IEnumerable<T>)
Merge two collections together.
public static List<T> Merge<T>(IEnumerable<T> list1, IEnumerable<T> list2)
Parameters
list1
IEnumerable<T>list2
IEnumerable<T>
Returns
- List<T>
Type Parameters
T
ToHashSet<T>(IEnumerable<T>)
public static HashSet<T> ToHashSet<T>(this IEnumerable<T> source)
Parameters
source
IEnumerable<T>
Returns
- HashSet<T>
Type Parameters
T
ToObservable<T>(IEnumerable<T>)
Converts collection to ObservableCollection<T> collection.
public static ObservableCollection<T> ToObservable<T>(this IEnumerable<T> source)
Parameters
source
IEnumerable<T>
Returns
Type Parameters
T