Lean
$LEAN_TAG$
|
Provides more extension methods for the enumerable types More...
Static Public Member Functions | |
static IReadOnlyDictionary< K, V > | ToReadOnlyDictionary< K, V > (this IEnumerable< KeyValuePair< K, V >> enumerable) |
Creates a new read-only dictionary from the key value pairs More... | |
static HashSet< TResult > | ToHashSet< T, TResult > (this IEnumerable< T > enumerable, Func< T, TResult > selector) |
Creates a new HashSet<T> from the elements in the specified enumerable More... | |
static List< TResult > | ToList< T, TResult > (this IEnumerable< T > enumerable, Func< T, TResult > selector) |
Creates a new IList<T> from the projected elements in the specified enumerable More... | |
static TResult[] | ToArray< T, TResult > (this IEnumerable< T > enumerable, Func< T, TResult > selector) |
Creates a new array from the projected elements in the specified enumerable More... | |
static ImmutableArray< TResult > | ToImmutableArray< T, TResult > (this IEnumerable< T > enumerable, Func< T, TResult > selector) |
Creates a new immutable array from the projected elements in the specified enumerable More... | |
static bool | IsNullOrEmpty< T > (this IEnumerable< T > enumerable) |
Returns true if the specified enumerable is null or has no elements More... | |
static T | Median< T > (this IEnumerable< T > enumerable) |
Gets the median value in the collection More... | |
static TProperty | Median< T, TProperty > (this IEnumerable< T > collection, Func< T, TProperty > selector) |
Gets the median value in the collection More... | |
static int | BinarySearch< TItem, TSearch > (this IList< TItem > list, TSearch value, Func< TSearch, TItem, int > comparer) |
Performs a binary search on the specified collection. More... | |
static int | BinarySearch< TItem > (this IList< TItem > list, TItem value) |
Performs a binary search on the specified collection. More... | |
static int | BinarySearch< TItem > (this IList< TItem > list, TItem value, IComparer< TItem > comparer) |
Performs a binary search on the specified collection. More... | |
static IEnumerable< T > | Memoize< T > (this IEnumerable< T > enumerable) |
Wraps the specified enumerable such that it will only be enumerated once More... | |
static IEnumerable< T > | Range< T > (T start, T end, Func< T, T > incrementer, bool includeEndPoint=false) |
Produces the an enumerable of the range of values between start and end using the specified incrementing function More... | |
static IEnumerable< IEnumerable< T > > | GroupAdjacentBy< T > (this IEnumerable< T > enumerable, Func< T, T, bool > grouper) |
Groups adjacent elements of the enumerale using the specified grouper function More... | |
static bool | AreDifferent< T > (this ISet< T > left, ISet< T > right) |
Determines if there are any differences between the left and right collections. This method uses sets to improve performance and also uses lazy evaluation so if a difference is found, true is immediately returned and evaluation is halted. More... | |
static IEnumerable< T > | AsEnumerable< T > (this IEnumerator< T > enumerator) |
Converts an IEnumerator<T> to an IEnumerable<T> More... | |
static V | GetValueOrDefault< K, V > (this IDictionary< K, V > dictionary, K key, V defaultValue=default(V)) |
Gets the value associated with the specified key or provided default value if key is not found. More... | |
static void | DoForEach< T > (this IEnumerable< T > source, Action< T > action) |
Performs an action for each element in collection source More... | |
Provides more extension methods for the enumerable types
Definition at line 27 of file LinqExtensions.cs.
|
static |
Creates a new read-only dictionary from the key value pairs
K | The key type |
V | The value type |
enumerable | The IEnumerable of KeyValuePair instances to convert to a dictionary |
Definition at line 36 of file LinqExtensions.cs.
|
static |
Creates a new HashSet<T> from the elements in the specified enumerable
T | The item type of the source enumerable |
TResult | The type of the items in the output HashSet<T> |
enumerable | The items to be placed into the enumerable |
selector | Selects items from the enumerable to be placed into the HashSet<T> |
Definition at line 49 of file LinqExtensions.cs.
|
static |
Creates a new IList<T> from the projected elements in the specified enumerable
T | The item type of the source enumerable |
TResult | The type of the items in the output List<T> |
enumerable | The items to be placed into the list |
selector | Selects items from the enumerable to be placed into the List<T> |
Definition at line 62 of file LinqExtensions.cs.
|
static |
Creates a new array from the projected elements in the specified enumerable
T | The item type of the source enumerable |
TResult | The type of the items in the output array |
enumerable | The items to be placed into the array |
selector | Selects items from the enumerable to be placed into the array |
Definition at line 75 of file LinqExtensions.cs.
|
static |
Creates a new immutable array from the projected elements in the specified enumerable
T | The item type of the source enumerable |
TResult | The type of the items in the output array |
enumerable | The items to be placed into the array |
selector | Selects items from the enumerable to be placed into the array |
Definition at line 88 of file LinqExtensions.cs.
|
static |
Returns true if the specified enumerable is null or has no elements
T | The enumerable's item type |
enumerable | The enumerable to check for a value |
Definition at line 99 of file LinqExtensions.cs.
|
static |
Gets the median value in the collection
T | The item type in the collection |
enumerable | The enumerable of items to search |
Definition at line 110 of file LinqExtensions.cs.
|
static |
Gets the median value in the collection
T | The item type in the collection |
TProperty | The type of the value selected |
collection | The collection of items to search |
selector | Function used to select a value from collection items |
Definition at line 124 of file LinqExtensions.cs.
|
static |
Performs a binary search on the specified collection.
TItem | The type of the item. |
TSearch | The type of the searched item. |
list | The list to be searched. |
value | The value to search for. |
comparer | The comparer that is used to compare the value with the list items. |
Definition at line 138 of file LinqExtensions.cs.
|
static |
Performs a binary search on the specified collection.
TItem | The type of the item. |
list | The list to be searched. |
value | The value to search for. |
Definition at line 180 of file LinqExtensions.cs.
|
static |
Performs a binary search on the specified collection.
TItem | The type of the item. |
list | The list to be searched. |
value | The value to search for. |
comparer | The comparer that is used to compare the value with the list items. |
Definition at line 193 of file LinqExtensions.cs.
|
static |
Wraps the specified enumerable such that it will only be enumerated once
T | The enumerable's element type |
enumerable | The source enumerable to be wrapped |
Definition at line 204 of file LinqExtensions.cs.
|
static |
Produces the an enumerable of the range of values between start and end using the specified incrementing function
T | The enumerable item type |
start | The start of the range |
end | The end of the range, non-inclusive by default |
incrementer | The incrementing function, with argument of the current item |
includeEndPoint | True to emit the end point, false otherwise |
T | : | IComparable |
Definition at line 220 of file LinqExtensions.cs.
|
static |
Groups adjacent elements of the enumerale using the specified grouper function
T | The enumerable item type |
enumerable | The source enumerable to be grouped |
grouper | A function that accepts the previous value and the next value and returns true if the next value belongs in the same group as the previous value, otherwise returns false |
Definition at line 251 of file LinqExtensions.cs.
|
static |
Determines if there are any differences between the left and right collections. This method uses sets to improve performance and also uses lazy evaluation so if a difference is found, true is immediately returned and evaluation is halted.
T | The item type |
left | The left set |
right | The right set |
Definition at line 286 of file LinqExtensions.cs.
|
static |
Converts an IEnumerator<T> to an IEnumerable<T>
T | Collection element type |
enumerator | The enumerator to convert to an enumerable |
Definition at line 301 of file LinqExtensions.cs.
|
static |
Gets the value associated with the specified key or provided default value if key is not found.
K | The key type |
V | The value type |
dictionary | The dictionary instance |
key | Lookup key |
defaultValue | Default value |
Definition at line 321 of file LinqExtensions.cs.
|
static |
Performs an action for each element in collection source
T |
source | Collection source |
action | An action to perform |
Definition at line 333 of file LinqExtensions.cs.