Class CollectionExtensions
Inheritance
CollectionExtensions
Assembly: QFSW.QC.dll
Syntax
public static class CollectionExtensions
Methods
DistinctBy<TValue, TDistinct>(IEnumerable<TValue>, Func<TValue, TDistinct>)
Creates a distinct stream based on a custom predicate.
Declaration
public static IEnumerable<TValue> DistinctBy<TValue, TDistinct>(this IEnumerable<TValue> source, Func<TValue, TDistinct> predicate)
Parameters
Type |
Name |
Description |
IEnumerable<TValue> |
source |
The source IEnumerable.
|
Func<TValue, TDistinct> |
predicate |
The custom distinct item producer.
|
Returns
Type |
Description |
IEnumerable<TValue> |
The distinct stream.
|
Type Parameters
Name |
Description |
TValue |
The type of the IEnumerable.
|
TDistinct |
The type of the value to test for distinctness.
|
InsertionSortBy<T>(IList<T>, Func<T, Int32>)
Declaration
public static void InsertionSortBy<T>(this IList<T> collection, Func<T, int> keySelector)
Parameters
Type Parameters
Invert<TKey, TValue>(IDictionary<TKey, TValue>)
Inverts the key/value relationship between the items in the dictionary.
Declaration
public static Dictionary<TValue, TKey> Invert<TKey, TValue>(this IDictionary<TKey, TValue> source)
Parameters
Returns
Type |
Description |
Dictionary<TValue, TKey> |
Dictionary with the inverted relationship.
|
Type Parameters
Name |
Description |
TKey |
|
TValue |
|
LastOr<T>(IEnumerable<T>, T)
Declaration
public static T LastOr<T>(this IEnumerable<T> source, T value)
Parameters
Returns
Type Parameters
Reversed<T>(IReadOnlyList<T>)
Reverses the order of the sequence.
Declaration
public static IEnumerable<T> Reversed<T>(this IReadOnlyList<T> source)
Parameters
Returns
Type Parameters
SkipLast<T>(IEnumerable<T>)
Skips the last element in the sequence.
Declaration
public static IEnumerable<T> SkipLast<T>(this IEnumerable<T> source)
Parameters
Returns
Type Parameters
SubArray<T>(T[], Int32, Int32)
Gets a sub array of an existing array.
Declaration
public static T[] SubArray<T>(this T[] data, int index, int length)
Parameters
Type |
Name |
Description |
T[] |
data |
|
Int32 |
index |
Index to take the sub array from.
|
Int32 |
length |
The length of the sub array.
|
Returns
Type Parameters
Yield<T>(T)
Declaration
public static IEnumerable<T> Yield<T>(this T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Type Parameters