Class EnumerableExtensions
.NET Specific Helper Extensions for IEnumerable
Inheritance
System.Object
EnumerableExtensions
Namespace: Lucene.Net.Support
Assembly: Lucene.Net.dll
Syntax
public static class EnumerableExtensions : object
Methods
| Improve this Doc View SourceInPairs<T, TOut>(IEnumerable<T>, Func<T, T, TOut>)
Enumerates a sequence in pairs
Declaration
public static IEnumerable<TOut> InPairs<T, TOut>(this IEnumerable<T> source, Func<T, T, TOut> join)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | An System.Collections.Generic.IEnumerable<> to enumerate in pairs. |
Func<T, T, TOut> | join | A function that is invoked for each pair of elements. |
Returns
Type | Description |
---|---|
IEnumerable<TOut> | A new System.Collections.Generic.IEnumerable<> containing the results from each pair. |
Type Parameters
Name | Description |
---|---|
T | The type of the elements of |
TOut | The type of the elements returned from |
Remarks
In the case of an uneven amount of elements, the list call to join
pases
default(T)
as the second parameter.
Exceptions
Type | Condition |
---|---|
System. |
|
TakeAllButLast<T>(IEnumerable<T>)
Take all but the last element of the sequence.
Declaration
public static IEnumerable<T> TakeAllButLast<T>(this IEnumerable<T> source)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | This |
Returns
Type | Description |
---|---|
IEnumerable<T> | The resulting |
Type Parameters
Name | Description |
---|---|
T | The type of the elements of |
TakeAllButLast<T>(IEnumerable<T>, Int32)
Take all but the last n
elements of the sequence.
Declaration
public static IEnumerable<T> TakeAllButLast<T>(this IEnumerable<T> source, int n)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | This |
System. |
n | The number of elements at the end of the sequence to exclude. |
Returns
Type | Description |
---|---|
IEnumerable<T> | The resulting |
Type Parameters
Name | Description |
---|---|
T | The type of the elements of |