Linq.Extras Namespace

This namespace provides extension and helper methods to complement the System.Linq namespace
Classes
 | Class | Description
Public class | Infer | Provides helper methods to create functions and expression trees from lambda expressions, by taking advantage of generic type inference.
Public class | XComparer | Provides extension and helper methods to create, combine and work with comparers.
Public class | XComparerT | Provides helper methods to create comparers by taking advantage of generic type inference
Public class | XEnumerable | Provides extension and helper methods to work with sequences.
Public class | XEqualityComparer | Provides extension and helper methods to create and work with equality comparers.
Public class | XEqualityComparerT | Provides a helper method to create equality comparers by taking advantage of generic type inference
Public class | XList | Provides extension methods for working with lists.
Structures
 | Structure | Description
Public structure | ItemWithIndexT | Represents an element associated with its index in a sequence.
Public structure | XEnumerableWithIndexArrayEnumerableTSource | A sequence of elements associated with their index, optimized for the case when the underlying collection is an array.
Public structure | XEnumerableWithIndexArrayEnumerableTSourceEnumerator | Enumerates the elements of a XEnumerableWithIndexArrayEnumerableTSource.
Public structure | XEnumerableWithIndexEnumerableTSource | A sequence of elements associated with their index.
Public structure | XEnumerableWithIndexEnumerableTSourceEnumerator | Enumerates the elements of a XEnumerableWithIndexEnumerableTSource.
Public structure | XEnumerableWithIndexListEnumerableTSource | A sequence of elements associated with their index, optimized for the case when the underlying collection is a ListT.
Public structure | XEnumerableWithIndexListEnumerableTSourceEnumerator | Enumerates the elements of a XEnumerableWithIndexListEnumerableTSource.
Interfaces
 | Interface | Description
Public interface | INodeT | Represents a node in a hierarchy.
Enumerations
 | Enumeration | Description
Public enumeration | TreeTraversalMode | Defines the possible traversal orders when traversing a hierarchy of objects.


Infer Class

Provides helper methods to create functions and expression trees from lambda expressions, by taking advantage of generic type inference.
Inheritance Hierarchy
SystemObject
Linq.ExtrasInfer

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static class Infer
Public NotInheritable Class Infer
[<AbstractClassAttribute>]
[<SealedAttribute>]
type Infer =  class end
Methods
Name | Description
ExprTResult(ExpressionFuncTResult) | Returns an Expression<Func<TResult>>.
ExprT1, TResult(ExpressionFuncT1, TResult) | Returns an Expression<Func<T1, TResult>>.
ExprT1, T2, TResult(ExpressionFuncT1, T2, TResult) | Returns an Expression<Func<T1, T2, TResult>>.
ExprT1, T2, T3, TResult(ExpressionFuncT1, T2, T3, TResult) | Returns an Expression<Func<T1, T2, T3, TResult>>.
ExprT1, T2, T3, T4, TResult(ExpressionFuncT1, T2, T3, T4, TResult) | Returns an Expression<Func<T1, T2, T3, T4, TResult>>.
FuncTResult(FuncTResult) | Returns a Func<TResult>.
FuncT1, TResult(FuncT1, TResult) | Returns a Func<T1, TResult>.
FuncT1, T2, TResult(FuncT1, T2, TResult) | Returns a Func<T1, T2, TResult>.
FuncT1, T2, T3, TResult(FuncT1, T2, T3, TResult) | Returns a Func<T1, T2, T3, TResult>.
FuncT1, T2, T3, T4, TResult(FuncT1, T2, T3, T4, TResult) | Returns a Func<T1, T2, T3, T4, TResult>.
Top
See Also

Reference

Linq.Extras Namespace


Infer Methods

Methods
Name | Description
ExprTResult(ExpressionFuncTResult) | Returns an Expression<Func<TResult>>.
ExprT1, TResult(ExpressionFuncT1, TResult) | Returns an Expression<Func<T1, TResult>>.
ExprT1, T2, TResult(ExpressionFuncT1, T2, TResult) | Returns an Expression<Func<T1, T2, TResult>>.
ExprT1, T2, T3, TResult(ExpressionFuncT1, T2, T3, TResult) | Returns an Expression<Func<T1, T2, T3, TResult>>.
ExprT1, T2, T3, T4, TResult(ExpressionFuncT1, T2, T3, T4, TResult) | Returns an Expression<Func<T1, T2, T3, T4, TResult>>.
FuncTResult(FuncTResult) | Returns a Func<TResult>.
FuncT1, TResult(FuncT1, TResult) | Returns a Func<T1, TResult>.
FuncT1, T2, TResult(FuncT1, T2, TResult) | Returns a Func<T1, T2, TResult>.
FuncT1, T2, T3, TResult(FuncT1, T2, T3, TResult) | Returns a Func<T1, T2, T3, TResult>.
FuncT1, T2, T3, T4, TResult(FuncT1, T2, T3, T4, TResult) | Returns a Func<T1, T2, T3, T4, TResult>.
Top
See Also

Reference

Infer Class


Infer.Expr Method

Linq.Extras documentation

InferExpr Method

Overload List
Name | Description
ExprTResult(ExpressionFuncTResult) | Returns an Expression<Func<TResult>>.
ExprT1, TResult(ExpressionFuncT1, TResult) | Returns an Expression<Func<T1, TResult>>.
ExprT1, T2, TResult(ExpressionFuncT1, T2, TResult) | Returns an Expression<Func<T1, T2, TResult>>.
ExprT1, T2, T3, TResult(ExpressionFuncT1, T2, T3, TResult) | Returns an Expression<Func<T1, T2, T3, TResult>>.
ExprT1, T2, T3, T4, TResult(ExpressionFuncT1, T2, T3, T4, TResult) | Returns an Expression<Func<T1, T2, T3, T4, TResult>>.
Top
See Also

Reference

Infer Class


Infer.Expr(TResult) Method (Expression(Func(TResult)))

InferExprTResult Method (ExpressionFuncTResult)

Returns an Expression<Func<TResult>>.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static Expression<Func<TResult>> Expr<TResult>(
    Expression<Func<TResult>> expr
)

Public Shared Function Expr(Of TResult) (
    expr As Expression(Of Func(Of TResult))
) As Expression(Of Func(Of TResult))
static member Expr :
        expr : Expression<Func<'TResult>> -> Expression<Func<'TResult>>

Parameters

expr
Type: System.Linq.ExpressionsExpression Func TResult
A lambda expression representing the function whose expression tree will be returned.

Type Parameters

TResult
The type of the result.

Return Value

Type: Expression Func TResult
The expression passed as parameter.
Remarks
This method just returns its parameter. It's only a helper to take advantage of generic type inference.
See Also

Reference

Infer Class
Expr Overload


Infer.Expr(T1, TResult) Method (Expression(Func(T1, TResult)))

InferExprT1, TResult Method (ExpressionFuncT1, TResult)

Returns an Expression<Func<T1, TResult>>.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static Expression<Func<T1, TResult>> Expr<T1, TResult>(
    Expression<Func<T1, TResult>> expr
)

Public Shared Function Expr(Of T1, TResult) (
    expr As Expression(Of Func(Of T1, TResult))
) As Expression(Of Func(Of T1, TResult))
static member Expr :
        expr : Expression<Func<'T1, 'TResult>> -> Expression<Func<'T1, 'TResult>>

Parameters

expr
Type: System.Linq.ExpressionsExpression Func T1, TResult
A lambda expression representing the function whose expression tree will be returned.

Type Parameters

T1
The type of the first parameter.
TResult
The type of the result.

Return Value

Type: Expression Func T1, TResult
The expression passed as parameter.
Remarks
This method just returns its parameter. It's only a helper to take advantage of generic type inference.
See Also

Reference

Infer Class
Expr Overload


Infer.Expr(T1, T2, TResult) Method (Expression(Func(T1, T2, TResult)))

InferExprT1, T2, TResult Method (ExpressionFuncT1, T2, TResult)

Returns an Expression<Func<T1, T2, TResult>>.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static Expression<Func<T1, T2, TResult>> Expr<T1, T2, TResult>(
    Expression<Func<T1, T2, TResult>> expr
)

Public Shared Function Expr(Of T1, T2, TResult) (
    expr As Expression(Of Func(Of T1, T2, TResult))
) As Expression(Of Func(Of T1, T2, TResult))
static member Expr :
        expr : Expression<Func<'T1, 'T2, 'TResult>> -> Expression<Func<'T1, 'T2, 'TResult>>

Parameters

expr
Type: System.Linq.ExpressionsExpression Func T1, T2, TResult
A lambda expression representing the function whose expression tree will be returned.

Type Parameters

T1
The type of the first parameter.
T2
The type of the second parameter.
TResult
The type of the result.

Return Value

Type: Expression Func T1, T2, TResult
The expression passed as parameter.
Remarks
This method just returns its parameter. It's only a helper to take advantage of generic type inference.
See Also

Reference

Infer Class
Expr Overload


Infer.Expr(T1, T2, T3, TResult) Method (Expression(Func(T1, T2, T3, TResult)))

InferExprT1, T2, T3, TResult Method (ExpressionFuncT1, T2, T3, TResult)

Returns an Expression<Func<T1, T2, T3, TResult>>.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static Expression<Func<T1, T2, T3, TResult>> Expr<T1, T2, T3, TResult>(
    Expression<Func<T1, T2, T3, TResult>> expr
)

Public Shared Function Expr(Of T1, T2, T3, TResult) (
    expr As Expression(Of Func(Of T1, T2, T3, TResult))
) As Expression(Of Func(Of T1, T2, T3, TResult))
static member Expr :
        expr : Expression<Func<'T1, 'T2, 'T3, 'TResult>> -> Expression<Func<'T1, 'T2, 'T3, 'TResult>>

Parameters

expr
Type: System.Linq.ExpressionsExpression Func T1, T2, T3, TResult
A lambda expression representing the function whose expression tree will be returned.

Type Parameters

T1
The type of the first parameter.
T2
The type of the second parameter.
T3
The type of the third parameter.
TResult
The type of the result.

Return Value

Type: Expression Func T1, T2, T3, TResult
The expression passed as parameter.
Remarks
This method just returns its parameter. It's only a helper to take advantage of generic type inference.
See Also

Reference

Infer Class
Expr Overload


Infer.Expr(T1, T2, T3, T4, TResult) Method (Expression(Func(T1, T2, T3, T4, TResult)))

InferExprT1, T2, T3, T4, TResult Method (ExpressionFuncT1, T2, T3, T4, TResult)

Returns an Expression<Func<T1, T2, T3, T4, TResult>>.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static Expression<Func<T1, T2, T3, T4, TResult>> Expr<T1, T2, T3, T4, TResult>(
    Expression<Func<T1, T2, T3, T4, TResult>> expr
)

Public Shared Function Expr(Of T1, T2, T3, T4, TResult) (
    expr As Expression(Of Func(Of T1, T2, T3, T4, TResult))
) As Expression(Of Func(Of T1, T2, T3, T4, TResult))
static member Expr :
        expr : Expression<Func<'T1, 'T2, 'T3, 'T4, 'TResult>> -> Expression<Func<'T1, 'T2, 'T3, 'T4, 'TResult>>

Parameters

expr
Type: System.Linq.ExpressionsExpression Func T1, T2, T3, T4, TResult
A lambda expression representing the function whose expression tree will be returned.

Type Parameters

T1
The type of the first parameter.
T2
The type of the second parameter.
T3
The type of the third parameter.
T4
The type of the fourth parameter.
TResult
The type of the result.

Return Value

Type: Expression Func T1, T2, T3, T4, TResult
The expression passed as parameter.
Remarks
This method just returns its parameter. It's only a helper to take advantage of generic type inference.
See Also

Reference

Infer Class
Expr Overload


Infer.Func Method

InferFunc Method

Overload List
Name | Description
FuncTResult(FuncTResult) | Returns a Func<TResult>.
FuncT1, TResult(FuncT1, TResult) | Returns a Func<T1, TResult>.
FuncT1, T2, TResult(FuncT1, T2, TResult) | Returns a Func<T1, T2, TResult>.
FuncT1, T2, T3, TResult(FuncT1, T2, T3, TResult) | Returns a Func<T1, T2, T3, TResult>.
FuncT1, T2, T3, T4, TResult(FuncT1, T2, T3, T4, TResult) | Returns a Func<T1, T2, T3, T4, TResult>.
Top
See Also

Reference

Infer Class


Infer.Func(TResult) Method (Func(TResult))

InferFuncTResult Method (FuncTResult)

Returns a Func<TResult>.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static Func<TResult> Func<TResult>(
    Func<TResult> func
)

Public Shared Function Func(Of TResult) (
    func As Func(Of TResult)
) As Func(Of TResult)
static member Func :
        func : Func<'TResult> -> Func<'TResult>

Parameters

func
Type: SystemFunc TResult
A lambda expression representing the function to return.

Type Parameters

TResult
The type of the result.

Return Value

Type: Func TResult
The function passed as parameter.
Remarks
This method just returns its parameter. It's only a helper to take advantage of generic type inference.
See Also

Reference

Infer Class
Func Overload


Infer.Func(T1, TResult) Method (Func(T1, TResult))

InferFuncT1, TResult Method (FuncT1, TResult)

Returns a Func<T1, TResult>.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static Func<T1, TResult> Func<T1, TResult>(
    Func<T1, TResult> func
)

Public Shared Function Func(Of T1, TResult) (
    func As Func(Of T1, TResult)
) As Func(Of T1, TResult)
static member Func :
        func : Func<'T1, 'TResult> -> Func<'T1, 'TResult>

Parameters

func
Type: SystemFunc T1, TResult
A lambda expression representing the function to return.

Type Parameters

T1
The type of the first parameter.
TResult
The type of the result.

Return Value

Type: Func T1, TResult
The function passed as parameter.
Remarks
This method just returns its parameter. It's only a helper to take advantage of generic type inference.
See Also

Reference

Infer Class
Func Overload


Infer.Func(T1, T2, TResult) Method (Func(T1, T2, TResult))

InferFuncT1, T2, TResult Method (FuncT1, T2, TResult)

Returns a Func<T1, T2, TResult>.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static Func<T1, T2, TResult> Func<T1, T2, TResult>(
    Func<T1, T2, TResult> func
)

Public Shared Function Func(Of T1, T2, TResult) (
    func As Func(Of T1, T2, TResult)
) As Func(Of T1, T2, TResult)
static member Func :
        func : Func<'T1, 'T2, 'TResult> -> Func<'T1, 'T2, 'TResult>

Parameters

func
Type: SystemFunc T1, T2, TResult
A lambda expression representing the function to return.

Type Parameters

T1
The type of the first parameter.
T2
The type of the second parameter.
TResult
The type of the result.

Return Value

Type: Func T1, T2, TResult
The function passed as parameter.
Remarks
This method just returns its parameter. It's only a helper to take advantage of generic type inference.
See Also

Reference

Infer Class
Func Overload


Infer.Func(T1, T2, T3, TResult) Method (Func(T1, T2, T3, TResult))

InferFuncT1, T2, T3, TResult Method (FuncT1, T2, T3, TResult)

Returns a Func<T1, T2, T3, TResult>.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static Func<T1, T2, T3, TResult> Func<T1, T2, T3, TResult>(
    Func<T1, T2, T3, TResult> func
)

Public Shared Function Func(Of T1, T2, T3, TResult) (
    func As Func(Of T1, T2, T3, TResult)
) As Func(Of T1, T2, T3, TResult)
static member Func :
        func : Func<'T1, 'T2, 'T3, 'TResult> -> Func<'T1, 'T2, 'T3, 'TResult>

Parameters

func
Type: SystemFunc T1, T2, T3, TResult
A lambda expression representing the function to return.

Type Parameters

T1
The type of the first parameter.
T2
The type of the second parameter.
T3
The type of the third parameter.
TResult
The type of the result.

Return Value

Type: Func T1, T2, T3, TResult
The function passed as parameter.
Remarks
This method just returns its parameter. It's only a helper to take advantage of generic type inference.
See Also

Reference

Infer Class
Func Overload


Infer.Func(T1, T2, T3, T4, TResult) Method (Func(T1, T2, T3, T4, TResult))

InferFuncT1, T2, T3, T4, TResult Method (FuncT1, T2, T3, T4, TResult)

Returns a Func<T1, T2, T3, T4, TResult>.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static Func<T1, T2, T3, T4, TResult> Func<T1, T2, T3, T4, TResult>(
    Func<T1, T2, T3, T4, TResult> func
)

Public Shared Function Func(Of T1, T2, T3, T4, TResult) (
    func As Func(Of T1, T2, T3, T4, TResult)
) As Func(Of T1, T2, T3, T4, TResult)
static member Func :
        func : Func<'T1, 'T2, 'T3, 'T4, 'TResult> -> Func<'T1, 'T2, 'T3, 'T4, 'TResult>

Parameters

func
Type: SystemFunc T1, T2, T3, T4, TResult
A lambda expression representing the function to return.

Type Parameters

T1
The type of the first parameter.
T2
The type of the second parameter.
T3
The type of the third parameter.
T4
The type of the fourth parameter.
TResult
The type of the result.

Return Value

Type: Func T1, T2, T3, T4, TResult
The function passed as parameter.
Remarks
This method just returns its parameter. It's only a helper to take advantage of generic type inference.
See Also

Reference

Infer Class
Func Overload


INode(T) Interface

INodeT Interface

Represents a node in a hierarchy.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public interface INode<T>

Public Interface INode(Of T)
type INode<'T> =  interface end

Type Parameters

T
The type of the elements in the hierarchy.

The INodeT type exposes the following members.

Properties
 | Name | Description
Public property | Children | The child nodes of this node.
Public property | Item | The value of the element contained in this node.
Public property | Level | The depth of this node in the hierarchy (root nodes have level 0).
Public property | Parent | The parent node of this node.
Top
See Also

Reference

Linq.Extras Namespace


INode(T) Properties

INodeT Properties

The INodeT generic type exposes the following members.

Properties
 | Name | Description
Public property | Children | The child nodes of this node.
Public property | Item | The value of the element contained in this node.
Public property | Level | The depth of this node in the hierarchy (root nodes have level 0).
Public property | Parent | The parent node of this node.
Top
See Also

Reference

INodeT Interface


INode(T).Children Property

INodeTChildren Property

The child nodes of this node.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
IList<INode<T>> Children { get; }
ReadOnly Property Children As IList(Of INode(Of T))
    Get
abstract Children : IList<INode<'T>> with get

Property Value

Type: IList INode T
See Also

Reference

INodeT Interface


INode(T).Item Property

INodeTItem Property

The value of the element contained in this node.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
T Item { get; }
ReadOnly Property Item As T
    Get
abstract Item : 'T with get

Property Value

Type: T
See Also

Reference

INodeT Interface


INode(T).Level Property

INodeTLevel Property

The depth of this node in the hierarchy (root nodes have level 0).

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
int Level { get; }
ReadOnly Property Level As Integer
    Get
abstract Level : int with get

Property Value

Type: Int32
See Also

Reference

INodeT Interface


INode(T).Parent Property

INodeTParent Property

The parent node of this node.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
INode<T>? Parent { get; }
ReadOnly Property Parent As INode(Of T)
    Get
abstract Parent : INode<'T> with get

Property Value

Type: INode T
See Also

Reference

INodeT Interface


ItemWithIndex(T) Structure

ItemWithIndexT Structure

Represents an element associated with its index in a sequence.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public readonly struct ItemWithIndex<T>

Public Structure ItemWithIndex(Of T)
[<SealedAttribute>]
type ItemWithIndex<'T> =  struct end

Type Parameters

T
The type of the element.

The ItemWithIndexT type exposes the following members.

Constructors
 | Name | Description
Public method | ItemWithIndexT | Initializes a new instance of ItemWithIndexT.
Top
Properties
 | Name | Description
Public property | Index | The index of the element in the sequence.
Public property | Item | The value of the element.
Top
Methods
 | Name | Description
Public method | Deconstruct | Deconstructs this ItemWithIndexT into its item and index.
Public method | Equals | (Inherited from ValueType.)
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | ToString | (Inherited from ValueType.)
Top
See Also

Reference

Linq.Extras Namespace


ItemWithIndex(T) Constructor

ItemWithIndexT Constructor

Initializes a new instance of ItemWithIndexT.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public ItemWithIndex(
    T item,
    int index
)
Public Sub New (
    item As T,
    index As Integer
)
new :
        item : 'T *
        index : int -> ItemWithIndex

Parameters

item
Type: T
index
Type: SystemInt32
See Also

Reference

ItemWithIndexT Structure


ItemWithIndex(T) Properties

ItemWithIndexT Properties

The ItemWithIndexT generic type exposes the following members.

Properties
 | Name | Description
Public property | Index | The index of the element in the sequence.
Public property | Item | The value of the element.
Top
See Also

Reference

ItemWithIndexT Structure


ItemWithIndex(T).Index Property

ItemWithIndexTIndex Property

The index of the element in the sequence.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public int Index { get; }
Public ReadOnly Property Index As Integer
    Get
member Index : int with get

Property Value

Type: Int32
See Also

Reference

ItemWithIndexT Structure


ItemWithIndex(T).Item Property

ItemWithIndexTItem Property

The value of the element.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public T Item { get; }
Public ReadOnly Property Item As T
    Get
member Item : 'T with get

Property Value

Type: T
See Also

Reference

ItemWithIndexT Structure


ItemWithIndex(T) Methods

ItemWithIndexT Methods

The ItemWithIndexT generic type exposes the following members.

Methods
 | Name | Description
Public method | Deconstruct | Deconstructs this ItemWithIndexT into its item and index.
Public method | Equals | (Inherited from ValueType.)
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | ToString | (Inherited from ValueType.)
Top
See Also

Reference

ItemWithIndexT Structure


ItemWithIndex(T).Deconstruct Method

ItemWithIndexTDeconstruct Method

Deconstructs this ItemWithIndexT into its item and index.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public void Deconstruct(
    out T item,
    out int index
)
Public Sub Deconstruct (
    <OutAttribute> ByRef item As T,
    <OutAttribute> ByRef index As Integer
)
member Deconstruct :
        item : 'T byref *
        index : int byref -> unit

Parameters

item
Type: T
The item.
index
Type: SystemInt32
The index.
See Also

Reference

ItemWithIndexT Structure


TreeTraversalMode Enumeration

Defines the possible traversal orders when traversing a hierarchy of objects.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public enum TreeTraversalMode
Public Enumeration TreeTraversalMode
type TreeTraversalMode
Members
Member name | Value | Description
DepthFirst | 0 | Depth-first traversal. For each node, explores its children before its siblings.
BreadthFirst | 1 | Breadth-first traversal. For each node, explores its siblings before its children.
See Also

Reference

Linq.Extras Namespace


XComparer Class

Provides extension and helper methods to create, combine and work with comparers.
Inheritance Hierarchy
SystemObject
Linq.ExtrasXComparer

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static class XComparer
<ExtensionAttribute>
Public NotInheritable Class XComparer
[<AbstractClassAttribute>]
[<SealedAttribute>]
[<ExtensionAttribute>]
type XComparer =  class end

The XComparer type exposes the following members.

Methods
Name | Description
ByT, TKey | Creates a comparer with ascending order based on the specified comparison key and key comparer.
ByDescendingT, TKey | Creates a comparer with descending order based on the specified comparison key and key comparer.
ChainWithT | Chains two comparers. The resulting comparer will first compare items using comparer, and if it's not enough to decide which is greater, it will use nextComparer to decide.
FromComparisonT | Creates a comparer that uses the specified ComparisonT delegate to compare objects.
MaxT | Returns the greater of two items according to comparer.
MinT | Returns the lesser of two items according to comparer.
ReverseT | Returns a comparer that has the reverse logic of the original comparer.
ThenByT, TKey | Chains a secondary comparer with ascending order based on the specified key to an existing comparer.
ThenByDescendingT, TKey | Chains a secondary comparer with descending order based on the specified key to an existing comparer.
Top
See Also

Reference

Linq.Extras Namespace


XComparer Methods

The XComparer type exposes the following members.

Methods
Name | Description
ByT, TKey | Creates a comparer with ascending order based on the specified comparison key and key comparer.
ByDescendingT, TKey | Creates a comparer with descending order based on the specified comparison key and key comparer.
ChainWithT | Chains two comparers. The resulting comparer will first compare items using comparer, and if it's not enough to decide which is greater, it will use nextComparer to decide.
FromComparisonT | Creates a comparer that uses the specified ComparisonT delegate to compare objects.
MaxT | Returns the greater of two items according to comparer.
MinT | Returns the lesser of two items according to comparer.
ReverseT | Returns a comparer that has the reverse logic of the original comparer.
ThenByT, TKey | Chains a secondary comparer with ascending order based on the specified key to an existing comparer.
ThenByDescendingT, TKey | Chains a secondary comparer with descending order based on the specified key to an existing comparer.
Top
See Also

Reference

XComparer Class


XComparer.By(T, TKey) Method

XComparerByT, TKey Method

Creates a comparer with ascending order based on the specified comparison key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IComparer<T> By<T, TKey>(
    Func<T, TKey> keySelector,
    IComparer<TKey>? keyComparer = null
)

Public Shared Function By(Of T, TKey) (
    keySelector As Func(Of T, TKey),
    Optional keyComparer As IComparer(Of TKey) = Nothing
) As IComparer(Of T)
static member By :
        keySelector : Func<'T, 'TKey> *
        ?keyComparer : IComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IComparer<'T>

Parameters

keySelector
Type: SystemFunc T, TKey
A function that returns the comparison key.
keyComparer (Optional)
Type: System.Collections.GenericIComparer TKey
An optional comparer used to compare the keys.

Type Parameters

T
The type of the objects to compare.
TKey
The type of the comparison key.

Return Value

Type: IComparer T
A comparer based on the specified comparison key and key comparer.
See Also

Reference

XComparer Class


XComparer.ByDescending(T, TKey) Method

XComparerByDescendingT, TKey Method

Creates a comparer with descending order based on the specified comparison key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IComparer<T> ByDescending<T, TKey>(
    Func<T, TKey> keySelector,
    IComparer<TKey>? keyComparer = null
)

Public Shared Function ByDescending(Of T, TKey) (
    keySelector As Func(Of T, TKey),
    Optional keyComparer As IComparer(Of TKey) = Nothing
) As IComparer(Of T)
static member ByDescending :
        keySelector : Func<'T, 'TKey> *
        ?keyComparer : IComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IComparer<'T>

Parameters

keySelector
Type: SystemFunc T, TKey
A function that returns the comparison key.
keyComparer (Optional)
Type: System.Collections.GenericIComparer TKey
An optional comparer used to compare the keys.

Type Parameters

T
The type of the objects to compare.
TKey
The type of the comparison key.

Return Value

Type: IComparer T
A comparer based on the specified comparison key and key comparer.
See Also

Reference

XComparer Class


XComparer.ChainWith(T) Method

XComparerChainWithT Method

Chains two comparers. The resulting comparer will first compare items using comparer, and if it's not enough to decide which is greater, it will use nextComparer to decide.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IComparer<T> ChainWith<T>(
    this IComparer<T> comparer,
    IComparer<T> nextComparer
)

<ExtensionAttribute>
Public Shared Function ChainWith(Of T) (
    comparer As IComparer(Of T),
    nextComparer As IComparer(Of T)
) As IComparer(Of T)
[<ExtensionAttribute>]
static member ChainWith :
        comparer : IComparer<'T> *
        nextComparer : IComparer<'T> -> IComparer<'T>

Parameters

comparer
Type: System.Collections.GenericIComparer T
The primary comparer.
nextComparer
Type: System.Collections.GenericIComparer T
The secondary comparer.

Type Parameters

T
The type of the objects to compare.

Return Value

Type: IComparer T
A comparer that will use the primary comparer, then the secondary comparer if necessary.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IComparer T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XComparer Class


XComparer.FromComparison(T) Method

XComparerFromComparisonT Method

Creates a comparer that uses the specified ComparisonT delegate to compare objects.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IComparer<T> FromComparison<T>(
    Comparison<T> comparison
)

Public Shared Function FromComparison(Of T) (
    comparison As Comparison(Of T)
) As IComparer(Of T)
static member FromComparison :
        comparison : Comparison<'T> -> IComparer<'T>

Parameters

comparison
Type: SystemComparison T
The ComparisonT delegate used to compare objects.

Type Parameters

T
The type of the objects to compare.

Return Value

Type: IComparer T
A comparer that uses the specified ComparisonT delegate to compare objects.
See Also

Reference

XComparer Class


XComparer.Max(T) Method

XComparerMaxT Method

Returns the greater of two items according to comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static T Max<T>(
    this IComparer<T> comparer,
    T x,
    T y
)

<ExtensionAttribute>
Public Shared Function Max(Of T) (
    comparer As IComparer(Of T),
    x As T,
    y As T
) As T
[<ExtensionAttribute>]
static member Max :
        comparer : IComparer<'T> *
        x : 'T *
        y : 'T -> 'T

Parameters

comparer
Type: System.Collections.GenericIComparer T
The comparer that performs the comparison.
x
Type: T
The first object to compare.
y
Type: T
The second object to compare.

Type Parameters

T
The type of the objects to compare.

Return Value

Type: T
x if x is greater than or equal to y; otherwise, y.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IComparer T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XComparer Class


XComparer.Min(T) Method

XComparerMinT Method

Returns the lesser of two items according to comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static T Min<T>(
    this IComparer<T> comparer,
    T x,
    T y
)

<ExtensionAttribute>
Public Shared Function Min(Of T) (
    comparer As IComparer(Of T),
    x As T,
    y As T
) As T
[<ExtensionAttribute>]
static member Min :
        comparer : IComparer<'T> *
        x : 'T *
        y : 'T -> 'T

Parameters

comparer
Type: System.Collections.GenericIComparer T
The comparer that performs the comparison.
x
Type: T
The first object to compare.
y
Type: T
The second object to compare.

Type Parameters

T
The type of the objects to compare.

Return Value

Type: T
x if x is lesser than or equal to y; otherwise, y.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IComparer T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XComparer Class


XComparer.Reverse(T) Method

XComparerReverseT Method

Returns a comparer that has the reverse logic of the original comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IComparer<T> Reverse<T>(
    this IComparer<T> comparer
)

<ExtensionAttribute>
Public Shared Function Reverse(Of T) (
    comparer As IComparer(Of T)
) As IComparer(Of T)
[<ExtensionAttribute>]
static member Reverse :
        comparer : IComparer<'T> -> IComparer<'T>

Parameters

comparer
Type: System.Collections.GenericIComparer T
The original comparer.

Type Parameters

T
The type of the objects to compare.

Return Value

Type: IComparer T
A comparer with the reverse logic of the original one.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IComparer T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XComparer Class


XComparer.ThenBy(T, TKey) Method

XComparerThenByT, TKey Method

Chains a secondary comparer with ascending order based on the specified key to an existing comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IComparer<T> ThenBy<T, TKey>(
    this IComparer<T> comparer,
    Func<T, TKey> keySelector,
    IComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function ThenBy(Of T, TKey) (
    comparer As IComparer(Of T),
    keySelector As Func(Of T, TKey),
    Optional keyComparer As IComparer(Of TKey) = Nothing
) As IComparer(Of T)
[<ExtensionAttribute>]
static member ThenBy :
        comparer : IComparer<'T> *
        keySelector : Func<'T, 'TKey> *
        ?keyComparer : IComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IComparer<'T>

Parameters

comparer
Type: System.Collections.GenericIComparer T
The primary comparer.
keySelector
Type: SystemFunc T, TKey
A function that returns the comparison key.
keyComparer (Optional)
Type: System.Collections.GenericIComparer TKey
An optional comparer used to compare the keys.

Type Parameters

T
The type of the objects to compare.
TKey
The type of the comparison key.

Return Value

Type: IComparer T
A comparer that will use the primary comparer, then the secondary comparer if necessary.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IComparer T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XComparer Class


XComparer.ThenByDescending(T, TKey) Method

XComparerThenByDescendingT, TKey Method

Chains a secondary comparer with descending order based on the specified key to an existing comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IComparer<T> ThenByDescending<T, TKey>(
    this IComparer<T> comparer,
    Func<T, TKey> keySelector,
    IComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function ThenByDescending(Of T, TKey) (
    comparer As IComparer(Of T),
    keySelector As Func(Of T, TKey),
    Optional keyComparer As IComparer(Of TKey) = Nothing
) As IComparer(Of T)
[<ExtensionAttribute>]
static member ThenByDescending :
        comparer : IComparer<'T> *
        keySelector : Func<'T, 'TKey> *
        ?keyComparer : IComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IComparer<'T>

Parameters

comparer
Type: System.Collections.GenericIComparer T
The primary comparer.
keySelector
Type: SystemFunc T, TKey
A function that returns the comparison key.
keyComparer (Optional)
Type: System.Collections.GenericIComparer TKey
An optional comparer used to compare the keys.

Type Parameters

T
The type of the objects to compare.
TKey
The type of the comparison key.

Return Value

Type: IComparer T
A comparer that will use the primary comparer, then the secondary comparer if necessary.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IComparer T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XComparer Class


XComparer(T) Class

XComparerT Class

Provides helper methods to create comparers by taking advantage of generic type inference
Inheritance Hierarchy
SystemObject
Linq.ExtrasXComparerT

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static class XComparer<T>

Public NotInheritable Class XComparer(Of T)
[<AbstractClassAttribute>]
[<SealedAttribute>]
type XComparer<'T> =  class end

Type Parameters

T
The type of the objects to compare.

The XComparerT type exposes the following members.

Methods
Name | Description
ByTKey | Creates a comparer with ascending order based on the specified comparison key and key comparer.
ByDescendingTKey | Creates a comparer with descending order based on the specified comparison key and key comparer.
FromComparison | Creates a comparer that uses the specified ComparisonT delegate to compare objects.
Top
See Also

Reference

Linq.Extras Namespace


XComparer(T) Methods

XComparerT Methods

The XComparerT generic type exposes the following members.

Methods
Name | Description
ByTKey | Creates a comparer with ascending order based on the specified comparison key and key comparer.
ByDescendingTKey | Creates a comparer with descending order based on the specified comparison key and key comparer.
FromComparison | Creates a comparer that uses the specified ComparisonT delegate to compare objects.
Top
See Also

Reference

XComparerT Class


XComparer(T).By(TKey) Method

XComparerTByTKey Method

Creates a comparer with ascending order based on the specified comparison key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IComparer<T> By<TKey>(
    Func<T, TKey> keySelector,
    IComparer<TKey>? keyComparer = null
)

Public Shared Function By(Of TKey) (
    keySelector As Func(Of T, TKey),
    Optional keyComparer As IComparer(Of TKey) = Nothing
) As IComparer(Of T)
static member By :
        keySelector : Func<'T, 'TKey> *
        ?keyComparer : IComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IComparer<'T>

Parameters

keySelector
Type: SystemFunc T, TKey
A function that returns the comparison key.
keyComparer (Optional)
Type: System.Collections.GenericIComparer TKey
An optional comparer used to compare the keys.

Type Parameters

TKey
The type of the comparison key.

Return Value

Type: IComparer T
A comparer based on the specified comparison key and key comparer.
See Also

Reference

XComparerT Class


XComparer(T).ByDescending(TKey) Method

XComparerTByDescendingTKey Method

Creates a comparer with descending order based on the specified comparison key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IComparer<T> ByDescending<TKey>(
    Func<T, TKey> keySelector,
    IComparer<TKey>? keyComparer = null
)

Public Shared Function ByDescending(Of TKey) (
    keySelector As Func(Of T, TKey),
    Optional keyComparer As IComparer(Of TKey) = Nothing
) As IComparer(Of T)
static member ByDescending :
        keySelector : Func<'T, 'TKey> *
        ?keyComparer : IComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IComparer<'T>

Parameters

keySelector
Type: SystemFunc T, TKey
A function that returns the comparison key.
keyComparer (Optional)
Type: System.Collections.GenericIComparer TKey
An optional comparer used to compare the keys.

Type Parameters

TKey
The type of the comparison key.

Return Value

Type: IComparer T
A comparer based on the specified comparison key and key comparer.
See Also

Reference

XComparerT Class


XComparer(T).FromComparison Method

XComparerTFromComparison Method

Creates a comparer that uses the specified ComparisonT delegate to compare objects.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IComparer<T> FromComparison(
    Comparison<T> comparison
)
Public Shared Function FromComparison (
    comparison As Comparison(Of T)
) As IComparer(Of T)
static member FromComparison :
        comparison : Comparison<'T> -> IComparer<'T>

Parameters

comparison
Type: SystemComparison T
The ComparisonT delegate used to compare objects.

Return Value

Type: IComparer T
A comparer that uses the specified ComparisonT delegate to compare objects.
See Also

Reference

XComparerT Class


XEnumerable Class

Provides extension and helper methods to work with sequences.
Inheritance Hierarchy
SystemObject
Linq.ExtrasXEnumerable

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static class XEnumerable
<ExtensionAttribute>
Public NotInheritable Class XEnumerable
[<AbstractClassAttribute>]
[<SealedAttribute>]
[<ExtensionAttribute>]
type XEnumerable =  class end

The XEnumerable type exposes the following members.

Methods
Name | Description
AppendTSource | Obsolete. Appends the specified element to the specified sequence.
BatchTSource | Splits the input sequence into a sequence of batches of the specified size.
CommonPrefixTSource | Returns the common prefix of two sequences, according to the specified comparer.
DenseRankByTSource, TKey, TResult | Associates an ascending dense rank to each element of the input sequence, based on the specified key and key comparer.
DenseRankByDescendingTSource, TKey, TResult | Associates a descending dense rank to each element of the input sequence, based on the specified key and key comparer.
DistinctByTSource, TKey | Returns a sequence with distinct elements from the input sequence based on the specified key and key comparer.
DistinctUntilChangedTSource | Returns a sequence with distinct adjacent elements from the input sequence based on the specified comparer.
DistinctUntilChangedByTSource, TKey | Returns a sequence with distinct adjacent elements from the input sequence based on the specified key and key comparer.
ElementAtOrDefaultTSource | Returns the element at a specified index in a sequence, or the specified default value if the index is out of range.
EmptyTSource | Produces an empty sequence.
ExceptByTSource, TKey | Produces the set difference of two sequences by using the specified key and key comparer to test for equality between elements.
FirstOrDefaultTSource(IEnumerableTSource, TSource) | Returns the first element of a sequence or the specified default value if the sequence contains no elements.
FirstOrDefaultTSource(IEnumerableTSource, FuncTSource, Boolean, TSource) | Returns the first element of the sequence that satisfies a condition or the specied default value if no such element is found.
FlattenTNode(IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode) | Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.
FlattenTNode, TResult(IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode, FuncTNode, TResult) | Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.
FlattenTNode, TResult(IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode, FuncTNode, Int32, TResult) | Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.
FullOuterJoinTLeft, TRight, TKey, TResult | Produces the full outer join of two sequences.
GenerateTElement(FuncInt32, TElement) | Generates a sequence from an index-based generator function.
GenerateTElement(TElement, FuncTElement, TElement) | Generates a sequence from a seed and a generator function.
GroupUntilChangedTSource | Groups equal adjacent elements from the input sequence based on the specified comparer.
GroupUntilChangedByTSource, TKey | Groups adjacent elements from the input sequence that have the same value for the specified key, according to the specified key comparer.
IndexOfTSource(IEnumerableTSource, FuncTSource, Boolean) | Returns the position of the first element of source that verifies the specified predicate, or -1 if it is not found.
IndexOfTSource(IEnumerableTSource, TSource, IEqualityComparerTSource) | Returns the position of the first occurrence of item in the source sequence, or -1 if it is not found.
IndexOfSubstringTSource | Returns the position of the first occurrence of the specified substring in the source sequence, or -1 if it is not found.
IntersectByTSource, TKey | Produces the set intersection of two sequences, based on the specified key and key comparer.
IsNullOrEmpty(IEnumerable) | Indicates whether a sequence is null or empty.
IsNullOrEmptyTSource(IEnumerableTSource) | Indicates whether a sequence is null or empty.
LastIndexOfTSource(IEnumerableTSource, FuncTSource, Boolean) | Returns the position of the last element of source that verifies the specified predicate, or -1 if it is not found.
LastIndexOfTSource(IEnumerableTSource, TSource, IEqualityComparerTSource) | Returns the position of the last occurrence of item in the source sequence, or -1 if it is not found.
LastOrDefaultTSource(IEnumerableTSource, TSource) | Returns the last element of a sequence or the specified default value if the sequence contains no elements.
LastOrDefaultTSource(IEnumerableTSource, FuncTSource, Boolean, TSource) | Returns the last element of the sequence that satisfies a condition or the specied default value if no such element is found.
LeftOuterJoinTLeft, TRight, TKey, TResult | Produces the left outer join of two sequences.
MaxTSource | Returns the maximum element of the sequence according to the specified comparer.
MaxByTSource, TKey | Returns the element of the sequence that has the maximum value for the specified key.
MinTSource | Returns the minimum element of the sequence according to the specified comparer.
MinByTSource, TKey | Returns the element of the sequence that has the minimum value for the specified key.
NoneTSource(IEnumerableTSource) | Checks if the sequence is empty.
NoneTSource(IEnumerableTSource, FuncTSource, Boolean) | Checks if the sequence contains no element that matches the predicate.
PrependTSource | Obsolete. Prepends the specified element to the specified sequence.
RankByTSource, TKey, TResult | Associates an ascending rank to each element of the input sequence, based on the specified key and key comparer.
RankByDescendingTSource, TKey, TResult | Associates a descending rank to each element of the input sequence, based on the specified key and key comparer.
RightOuterJoinTLeft, TRight, TKey, TResult | Produces the right outer join of two sequences.
SequenceEqualByTSource, TKey | Determines whether two sequences are equal by comparing their elements using the specified key and key comparer.
SingleOrDefaultTSource(IEnumerableTSource, TSource) | Returns the only element of a sequence, or the specified default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.
SingleOrDefaultTSource(IEnumerableTSource, FuncTSource, Boolean, TSource) | Returns the only element of a sequence that satisfies a specified condition, or the specified default value if no such element exists; this method throws an exception if more than one element satisfies the condition.
ToArrayTSource | Creates an array from the elements in the source sequence. Unlike ToArrayTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate an array of the right size from the start, hence suppressing the need for subsequent allocations and improving performance.
ToHashSetTSource | Obsolete. Creates a hash set from the elements in the source sequence.
ToHierarchyTSource, TId | Builds a hierarchy from a flat sequence of elements, based on an Id/ParentId relation.
ToLinkedListTSource | Creates a linked list from the elements in the source sequence.
ToListTSource | Creates a ListT from the elements in the source sequence. Unlike ToListTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate a list with sufficient capacity, hence suppressing the need for subsequent allocations, and improving performance.
ToQueueTSource | Creates a queue from the elements in the source sequence.
ToStackTSource | Creates a stack from the elements in the source sequence.
UnionByTSource, TKey | Produces the set union of two sequences, based on the specified key and key comparer.
UnitTSource | Produces a sequence containing a single element.
WithIndexTSource(IEnumerableTSource) | Associates an index to each element of the source sequence.
WithIndexTSource(ListTSource) | Associates an index to each element of the source ListT.
WithIndexTSource(TSource) | Associates an index to each element of the source array.
WithoutIndexTSource | Removes the indexes from a sequence of indexed elements, returning only the elements themselves.
Top
See Also

Reference

Linq.Extras Namespace


XEnumerable Methods

The XEnumerable type exposes the following members.

Methods
Name | Description
AppendTSource | Obsolete. Appends the specified element to the specified sequence.
BatchTSource | Splits the input sequence into a sequence of batches of the specified size.
CommonPrefixTSource | Returns the common prefix of two sequences, according to the specified comparer.
DenseRankByTSource, TKey, TResult | Associates an ascending dense rank to each element of the input sequence, based on the specified key and key comparer.
DenseRankByDescendingTSource, TKey, TResult | Associates a descending dense rank to each element of the input sequence, based on the specified key and key comparer.
DistinctByTSource, TKey | Returns a sequence with distinct elements from the input sequence based on the specified key and key comparer.
DistinctUntilChangedTSource | Returns a sequence with distinct adjacent elements from the input sequence based on the specified comparer.
DistinctUntilChangedByTSource, TKey | Returns a sequence with distinct adjacent elements from the input sequence based on the specified key and key comparer.
ElementAtOrDefaultTSource | Returns the element at a specified index in a sequence, or the specified default value if the index is out of range.
EmptyTSource | Produces an empty sequence.
ExceptByTSource, TKey | Produces the set difference of two sequences by using the specified key and key comparer to test for equality between elements.
FirstOrDefaultTSource(IEnumerableTSource, TSource) | Returns the first element of a sequence or the specified default value if the sequence contains no elements.
FirstOrDefaultTSource(IEnumerableTSource, FuncTSource, Boolean, TSource) | Returns the first element of the sequence that satisfies a condition or the specied default value if no such element is found.
FlattenTNode(IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode) | Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.
FlattenTNode, TResult(IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode, FuncTNode, TResult) | Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.
FlattenTNode, TResult(IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode, FuncTNode, Int32, TResult) | Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.
FullOuterJoinTLeft, TRight, TKey, TResult | Produces the full outer join of two sequences.
GenerateTElement(FuncInt32, TElement) | Generates a sequence from an index-based generator function.
GenerateTElement(TElement, FuncTElement, TElement) | Generates a sequence from a seed and a generator function.
GroupUntilChangedTSource | Groups equal adjacent elements from the input sequence based on the specified comparer.
GroupUntilChangedByTSource, TKey | Groups adjacent elements from the input sequence that have the same value for the specified key, according to the specified key comparer.
IndexOfTSource(IEnumerableTSource, FuncTSource, Boolean) | Returns the position of the first element of source that verifies the specified predicate, or -1 if it is not found.
IndexOfTSource(IEnumerableTSource, TSource, IEqualityComparerTSource) | Returns the position of the first occurrence of item in the source sequence, or -1 if it is not found.
IndexOfSubstringTSource | Returns the position of the first occurrence of the specified substring in the source sequence, or -1 if it is not found.
IntersectByTSource, TKey | Produces the set intersection of two sequences, based on the specified key and key comparer.
IsNullOrEmpty(IEnumerable) | Indicates whether a sequence is null or empty.
IsNullOrEmptyTSource(IEnumerableTSource) | Indicates whether a sequence is null or empty.
LastIndexOfTSource(IEnumerableTSource, FuncTSource, Boolean) | Returns the position of the last element of source that verifies the specified predicate, or -1 if it is not found.
LastIndexOfTSource(IEnumerableTSource, TSource, IEqualityComparerTSource) | Returns the position of the last occurrence of item in the source sequence, or -1 if it is not found.
LastOrDefaultTSource(IEnumerableTSource, TSource) | Returns the last element of a sequence or the specified default value if the sequence contains no elements.
LastOrDefaultTSource(IEnumerableTSource, FuncTSource, Boolean, TSource) | Returns the last element of the sequence that satisfies a condition or the specied default value if no such element is found.
LeftOuterJoinTLeft, TRight, TKey, TResult | Produces the left outer join of two sequences.
MaxTSource | Returns the maximum element of the sequence according to the specified comparer.
MaxByTSource, TKey | Returns the element of the sequence that has the maximum value for the specified key.
MinTSource | Returns the minimum element of the sequence according to the specified comparer.
MinByTSource, TKey | Returns the element of the sequence that has the minimum value for the specified key.
NoneTSource(IEnumerableTSource) | Checks if the sequence is empty.
NoneTSource(IEnumerableTSource, FuncTSource, Boolean) | Checks if the sequence contains no element that matches the predicate.
PrependTSource | Obsolete. Prepends the specified element to the specified sequence.
RankByTSource, TKey, TResult | Associates an ascending rank to each element of the input sequence, based on the specified key and key comparer.
RankByDescendingTSource, TKey, TResult | Associates a descending rank to each element of the input sequence, based on the specified key and key comparer.
RightOuterJoinTLeft, TRight, TKey, TResult | Produces the right outer join of two sequences.
SequenceEqualByTSource, TKey | Determines whether two sequences are equal by comparing their elements using the specified key and key comparer.
SingleOrDefaultTSource(IEnumerableTSource, TSource) | Returns the only element of a sequence, or the specified default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.
SingleOrDefaultTSource(IEnumerableTSource, FuncTSource, Boolean, TSource) | Returns the only element of a sequence that satisfies a specified condition, or the specified default value if no such element exists; this method throws an exception if more than one element satisfies the condition.
ToArrayTSource | Creates an array from the elements in the source sequence. Unlike ToArrayTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate an array of the right size from the start, hence suppressing the need for subsequent allocations and improving performance.
ToHashSetTSource | Obsolete. Creates a hash set from the elements in the source sequence.
ToHierarchyTSource, TId | Builds a hierarchy from a flat sequence of elements, based on an Id/ParentId relation.
ToLinkedListTSource | Creates a linked list from the elements in the source sequence.
ToListTSource | Creates a ListT from the elements in the source sequence. Unlike ToListTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate a list with sufficient capacity, hence suppressing the need for subsequent allocations, and improving performance.
ToQueueTSource | Creates a queue from the elements in the source sequence.
ToStackTSource | Creates a stack from the elements in the source sequence.
UnionByTSource, TKey | Produces the set union of two sequences, based on the specified key and key comparer.
UnitTSource | Produces a sequence containing a single element.
WithIndexTSource(IEnumerableTSource) | Associates an index to each element of the source sequence.
WithIndexTSource(ListTSource) | Associates an index to each element of the source ListT.
WithIndexTSource(TSource) | Associates an index to each element of the source array.
WithoutIndexTSource | Removes the indexes from a sequence of indexed elements, returning only the elements themselves.
Top
See Also

Reference

XEnumerable Class


XEnumerable.Append(TSource) Method

XEnumerableAppendTSource Method

Note: This API is now obsolete.

Appends the specified element to the specified sequence.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
[ObsoleteAttribute("This feature is now implemented directly in System.Linq. Please use Enumerable.Append instead")]
public static IEnumerable<TSource> Append<TSource>(
    IEnumerable<TSource> source,
    TSource item
)

<ObsoleteAttribute("This feature is now implemented directly in System.Linq. Please use Enumerable.Append instead")>
Public Shared Function Append(Of TSource) (
    source As IEnumerable(Of TSource),
    item As TSource
) As IEnumerable(Of TSource)
[<ObsoleteAttribute("This feature is now implemented directly in System.Linq. Please use Enumerable.Append instead")>]
static member Append :
        source : IEnumerable<'TSource> *
        item : 'TSource -> IEnumerable<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to append an element to.
item
Type: TSource
The element to append.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: IEnumerable TSource
The source sequence followed by the appended element.
Remarks
Linq already has this method in .NET Core, .NET Framework 4.7.1 and higher, and .NET Standard 1.6 and higher, so for these frameworks, the method is not marked as an extension method to avoid name conflicts.
See Also

Reference

XEnumerable Class


XEnumerable.Batch(TSource) Method

XEnumerableBatchTSource Method

Splits the input sequence into a sequence of batches of the specified size.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<IEnumerable<TSource>> Batch<TSource>(
    this IEnumerable<TSource> source,
    int size
)

<ExtensionAttribute>
Public Shared Function Batch(Of TSource) (
    source As IEnumerable(Of TSource),
    size As Integer
) As IEnumerable(Of IEnumerable(Of TSource))
[<ExtensionAttribute>]
static member Batch :
        source : IEnumerable<'TSource> *
        size : int -> IEnumerable<IEnumerable<'TSource>>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to split into batches.
size
Type: SystemInt32
The size of the batches

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: IEnumerable IEnumerable TSource
A sequence of batches of the specified size; the last batch can be shorter if there isn't enough elements remaining in the input sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.CommonPrefix(TSource) Method

XEnumerableCommonPrefixTSource Method

Returns the common prefix of two sequences, according to the specified comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TSource> CommonPrefix<TSource>(
    this IEnumerable<TSource> source,
    IEnumerable<TSource> other,
    IEqualityComparer<TSource>? comparer = null
)

<ExtensionAttribute>
Public Shared Function CommonPrefix(Of TSource) (
    source As IEnumerable(Of TSource),
    other As IEnumerable(Of TSource),
    Optional comparer As IEqualityComparer(Of TSource) = Nothing
) As IEnumerable(Of TSource)
[<ExtensionAttribute>]
static member CommonPrefix :
        source : IEnumerable<'TSource> *
        other : IEnumerable<'TSource> *
        ?comparer : IEqualityComparer<'TSource>
(* Defaults:
        let _comparer = defaultArg comparer null
*)
-> IEnumerable<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The first sequence.
other
Type: System.Collections.GenericIEnumerable TSource
The second sequence.
comparer (Optional)
Type: System.Collections.GenericIEqualityComparer TSource
The comparer used to test items for equality (can be null).

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: IEnumerable TSource
A sequence consisting of the first elements of source that match the first elements of other. The resulting sequence ends when the two input sequence start to differ.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.DenseRankBy(TSource, TKey, TResult) Method

XEnumerableDenseRankByTSource, TKey, TResult Method

Associates an ascending dense rank to each element of the input sequence, based on the specified key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TResult> DenseRankBy<TSource, TKey, TResult>(
    this IEnumerable<TSource> source,
    Func<TSource, TKey> keySelector,
    Func<TSource, int, TResult> resultSelector,
    IComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function DenseRankBy(Of TSource, TKey, TResult) (
    source As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    resultSelector As Func(Of TSource, Integer, TResult),
    Optional keyComparer As IComparer(Of TKey) = Nothing
) As IEnumerable(Of TResult)
[<ExtensionAttribute>]
static member DenseRankBy :
        source : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        resultSelector : Func<'TSource, int, 'TResult> *
        ?keyComparer : IComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TResult>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The input sequence.
keySelector
Type: SystemFunc TSource, TKey
A function that returns the key for each element.
resultSelector
Type: SystemFunc TSource, Int32, TResult
A projection that takes an element and its rank and returns an output element.
keyComparer (Optional)
Type: System.Collections.GenericIComparer TKey
The comparer used to compare the keys.

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the key used to compare elements.
TResult
The type of the elements in the output sequence.

Return Value

Type: IEnumerable TResult
A sequence of elements associated with their rank using the result selector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
This method produces a dense ranking, i.e. elements with equal rank produce no "holes" in the ranks. In the following example, there are two elements with rank 2, and the rank of the next element is 3.
Dense rank | Value
1 | A
2 | B
2 | B
3 | C
See Also

Reference

XEnumerable Class


XEnumerable.DenseRankByDescending(TSource, TKey, TResult) Method

XEnumerableDenseRankByDescendingTSource, TKey, TResult Method

Associates a descending dense rank to each element of the input sequence, based on the specified key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TResult> DenseRankByDescending<TSource, TKey, TResult>(
    this IEnumerable<TSource> source,
    Func<TSource, TKey> keySelector,
    Func<TSource, int, TResult> resultSelector,
    IComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function DenseRankByDescending(Of TSource, TKey, TResult) (
    source As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    resultSelector As Func(Of TSource, Integer, TResult),
    Optional keyComparer As IComparer(Of TKey) = Nothing
) As IEnumerable(Of TResult)
[<ExtensionAttribute>]
static member DenseRankByDescending :
        source : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        resultSelector : Func<'TSource, int, 'TResult> *
        ?keyComparer : IComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TResult>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The input sequence.
keySelector
Type: SystemFunc TSource, TKey
A function that returns the key for each element.
resultSelector
Type: SystemFunc TSource, Int32, TResult
A projection that takes an element and its rank and returns an output element.
keyComparer (Optional)
Type: System.Collections.GenericIComparer TKey
The comparer used to compare the keys.

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the key used to compare elements.
TResult
The type of the elements in the output sequence.

Return Value

Type: IEnumerable TResult
A sequence of elements associated with their rank using the result selector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
This method produces a dense ranking, i.e. elements with equal rank produce no "holes" in the ranks. See DenseRankByTSource, TKey, TResult(IEnumerableTSource, FuncTSource, TKey, FuncTSource, Int32, TResult, IComparerTKey) for an example.
See Also

Reference

XEnumerable Class


XEnumerable.DistinctBy(TSource, TKey) Method

XEnumerableDistinctByTSource, TKey Method

Returns a sequence with distinct elements from the input sequence based on the specified key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(
    this IEnumerable<TSource> source,
    Func<TSource, TKey> keySelector,
    IEqualityComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function DistinctBy(Of TSource, TKey) (
    source As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    Optional keyComparer As IEqualityComparer(Of TKey) = Nothing
) As IEnumerable(Of TSource)
[<ExtensionAttribute>]
static member DistinctBy :
        source : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        ?keyComparer : IEqualityComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return distinct elements from.
keySelector
Type: SystemFunc TSource, TKey
A delegate that returns the key used to test equality between elements.
keyComparer (Optional)
Type: System.Collections.GenericIEqualityComparer TKey
A comparer used to test equality between keys (can be null).

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the key used for testing equality between elements.

Return Value

Type: IEnumerable TSource
A sequence whose elements have distinct values for the specified key.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.DistinctUntilChanged(TSource) Method

XEnumerableDistinctUntilChangedTSource Method

Returns a sequence with distinct adjacent elements from the input sequence based on the specified comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TSource> DistinctUntilChanged<TSource>(
    this IEnumerable<TSource> source,
    IEqualityComparer<TSource>? comparer = null
)

<ExtensionAttribute>
Public Shared Function DistinctUntilChanged(Of TSource) (
    source As IEnumerable(Of TSource),
    Optional comparer As IEqualityComparer(Of TSource) = Nothing
) As IEnumerable(Of TSource)
[<ExtensionAttribute>]
static member DistinctUntilChanged :
        source : IEnumerable<'TSource> *
        ?comparer : IEqualityComparer<'TSource>
(* Defaults:
        let _comparer = defaultArg comparer null
*)
-> IEnumerable<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return distinct elements from.
comparer (Optional)
Type: System.Collections.GenericIEqualityComparer TSource
A comparer used to test equality between elements (can be null).

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: IEnumerable TSource
A sequence that contains only distinct adjacent elements

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.DistinctUntilChangedBy(TSource, TKey) Method

XEnumerableDistinctUntilChangedByTSource, TKey Method

Returns a sequence with distinct adjacent elements from the input sequence based on the specified key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TSource> DistinctUntilChangedBy<TSource, TKey>(
    this IEnumerable<TSource> source,
    Func<TSource, TKey> keySelector,
    IEqualityComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function DistinctUntilChangedBy(Of TSource, TKey) (
    source As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    Optional keyComparer As IEqualityComparer(Of TKey) = Nothing
) As IEnumerable(Of TSource)
[<ExtensionAttribute>]
static member DistinctUntilChangedBy :
        source : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        ?keyComparer : IEqualityComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return distinct elements from.
keySelector
Type: SystemFunc TSource, TKey
A delegate that returns the key used to test equality between elements.
keyComparer (Optional)
Type: System.Collections.GenericIEqualityComparer TKey
A comparer used to test equality between keys (can be null).

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the key used for testing equality between elements.

Return Value

Type: IEnumerable TSource
A sequence whose elements have distinct adjacent values for the specified key.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.ElementAtOrDefault(TSource) Method

XEnumerableElementAtOrDefaultTSource Method

Returns the element at a specified index in a sequence, or the specified default value if the index is out of range.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static TSource ElementAtOrDefault<TSource>(
    this IEnumerable<TSource> source,
    int index,
    TSource defaultValue
)

<ExtensionAttribute>
Public Shared Function ElementAtOrDefault(Of TSource) (
    source As IEnumerable(Of TSource),
    index As Integer,
    defaultValue As TSource
) As TSource
[<ExtensionAttribute>]
static member ElementAtOrDefault :
        source : IEnumerable<'TSource> *
        index : int *
        defaultValue : 'TSource -> 'TSource

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return an element from.
index
Type: SystemInt32
The zero-based index of the element to retrieve.
defaultValue
Type: TSource
The default value to return if there is no element at the specified index.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: TSource
defaultValue if the index is outside the bounds of the source sequence; otherwise, the element at the specified position in the source sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.Empty(TSource) Method

XEnumerableEmptyTSource Method

Produces an empty sequence.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TSource> Empty<TSource>()

Public Shared Function Empty(Of TSource) As IEnumerable(Of TSource)
static member Empty : unit -> IEnumerable<'TSource>

Type Parameters

TSource
The element typeof the sequence.

Return Value

Type: IEnumerable TSource
An empty sequence.
Remarks
Unlike EmptyTResult, this method returns a lazily evaluated sequence; EmptyTResult returns an empty array.
See Also

Reference

XEnumerable Class


XEnumerable.ExceptBy(TSource, TKey) Method

XEnumerableExceptByTSource, TKey Method

Produces the set difference of two sequences by using the specified key and key comparer to test for equality between elements.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TSource> ExceptBy<TSource, TKey>(
    this IEnumerable<TSource> source,
    IEnumerable<TSource> other,
    Func<TSource, TKey> keySelector,
    IEqualityComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function ExceptBy(Of TSource, TKey) (
    source As IEnumerable(Of TSource),
    other As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    Optional keyComparer As IEqualityComparer(Of TKey) = Nothing
) As IEnumerable(Of TSource)
[<ExtensionAttribute>]
static member ExceptBy :
        source : IEnumerable<'TSource> *
        other : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        ?keyComparer : IEqualityComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
A sequence whose elements that are not also in second will be returned.
other
Type: System.Collections.GenericIEnumerable TSource
A sequence whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.
keySelector
Type: SystemFunc TSource, TKey
A delegate that returns the key used to test equality between elements.
keyComparer (Optional)
Type: System.Collections.GenericIEqualityComparer TKey
A comparer used to test equality between keys (can be null).

Type Parameters

TSource
The type of the elements of the input sequences.
TKey
The type of the key used for testing equality between elements.

Return Value

Type: IEnumerable TSource
A sequence that contains the set difference of the elements of two sequences.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.FirstOrDefault Method

XEnumerableFirstOrDefault Method

Overload List
Name | Description
FirstOrDefaultTSource(IEnumerableTSource, TSource) | Returns the first element of a sequence or the specified default value if the sequence contains no elements.
FirstOrDefaultTSource(IEnumerableTSource, FuncTSource, Boolean, TSource) | Returns the first element of the sequence that satisfies a condition or the specied default value if no such element is found.
Top
See Also

Reference

XEnumerable Class


XEnumerable.FirstOrDefault(TSource) Method (IEnumerable(TSource), TSource)

XEnumerableFirstOrDefaultTSource Method (IEnumerableTSource, TSource)

Returns the first element of a sequence or the specified default value if the sequence contains no elements.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static TSource FirstOrDefault<TSource>(
    this IEnumerable<TSource> source,
    TSource defaultValue
)

<ExtensionAttribute>
Public Shared Function FirstOrDefault(Of TSource) (
    source As IEnumerable(Of TSource),
    defaultValue As TSource
) As TSource
[<ExtensionAttribute>]
static member FirstOrDefault :
        source : IEnumerable<'TSource> *
        defaultValue : 'TSource -> 'TSource

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return the first element of.
defaultValue
Type: TSource
The default value to return if the sequence is empty.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: TSource
defaultValue if source is empty; otherwise, the first element in source.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
FirstOrDefault Overload


XEnumerable.FirstOrDefault(TSource) Method (IEnumerable(TSource), Func(TSource, Boolean), TSource)

XEnumerableFirstOrDefaultTSource Method (IEnumerableTSource, FuncTSource, Boolean, TSource)

Returns the first element of the sequence that satisfies a condition or the specied default value if no such element is found.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static TSource FirstOrDefault<TSource>(
    this IEnumerable<TSource> source,
    Func<TSource, bool> predicate,
    TSource defaultValue
)

<ExtensionAttribute>
Public Shared Function FirstOrDefault(Of TSource) (
    source As IEnumerable(Of TSource),
    predicate As Func(Of TSource, Boolean),
    defaultValue As TSource
) As TSource
[<ExtensionAttribute>]
static member FirstOrDefault :
        source : IEnumerable<'TSource> *
        predicate : Func<'TSource, bool> *
        defaultValue : 'TSource -> 'TSource

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return an element from.
predicate
Type: SystemFunc TSource, Boolean
A function to test each element for a condition.
defaultValue
Type: TSource
The default value to return if no matching element is found.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: TSource
defaultValue if source is empty or if no element passes the test specified by predicate; otherwise, the first element in source that passes the test specified by predicate.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
FirstOrDefault Overload


XEnumerable.Flatten Method

XEnumerableFlatten Method

Overload List
Name | Description
FlattenTNode(IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode) | Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.
FlattenTNode, TResult(IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode, FuncTNode, TResult) | Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.
FlattenTNode, TResult(IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode, FuncTNode, Int32, TResult) | Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.
Top
See Also

Reference

XEnumerable Class


XEnumerable.Flatten(TNode) Method (IEnumerable(TNode), Func(TNode, IEnumerable(TNode)), TreeTraversalMode)

XEnumerableFlattenTNode Method (IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode)

Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TNode> Flatten<TNode>(
    this IEnumerable<TNode> source,
    Func<TNode, IEnumerable<TNode>> childrenSelector,
    TreeTraversalMode traversalMode
)

<ExtensionAttribute>
Public Shared Function Flatten(Of TNode) (
    source As IEnumerable(Of TNode),
    childrenSelector As Func(Of TNode, IEnumerable(Of TNode)),
    traversalMode As TreeTraversalMode
) As IEnumerable(Of TNode)
[<ExtensionAttribute>]
static member Flatten :
        source : IEnumerable<'TNode> *
        childrenSelector : Func<'TNode, IEnumerable<'TNode>> *
        traversalMode : TreeTraversalMode -> IEnumerable<'TNode>

Parameters

source
Type: System.Collections.GenericIEnumerable TNode
The source hierarchy to flatten.
childrenSelector
Type: SystemFunc TNode, IEnumerable TNode
The delegate used to retrieve the children of an element.
traversalMode
Type: Linq.ExtrasTreeTraversalMode
The traversal order.

Type Parameters

TNode
The type of the elements in the source hierarchy.

Return Value

Type: IEnumerable TNode
A flat sequence of the elements in the source hierarchy.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TNode. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
Flatten Overload


XEnumerable.Flatten(TNode, TResult) Method (IEnumerable(TNode), Func(TNode, IEnumerable(TNode)), TreeTraversalMode, Func(TNode, TResult))

XEnumerableFlattenTNode, TResult Method (IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode, FuncTNode, TResult)

Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TResult> Flatten<TNode, TResult>(
    this IEnumerable<TNode> source,
    Func<TNode, IEnumerable<TNode>> childrenSelector,
    TreeTraversalMode traversalMode,
    Func<TNode, TResult> resultSelector
)

<ExtensionAttribute>
Public Shared Function Flatten(Of TNode, TResult) (
    source As IEnumerable(Of TNode),
    childrenSelector As Func(Of TNode, IEnumerable(Of TNode)),
    traversalMode As TreeTraversalMode,
    resultSelector As Func(Of TNode, TResult)
) As IEnumerable(Of TResult)
[<ExtensionAttribute>]
static member Flatten :
        source : IEnumerable<'TNode> *
        childrenSelector : Func<'TNode, IEnumerable<'TNode>> *
        traversalMode : TreeTraversalMode *
        resultSelector : Func<'TNode, 'TResult> -> IEnumerable<'TResult>

Parameters

source
Type: System.Collections.GenericIEnumerable TNode
The source hierarchy to flatten.
childrenSelector
Type: SystemFunc TNode, IEnumerable TNode
The delegate used to retrieve the children of an element.
traversalMode
Type: Linq.ExtrasTreeTraversalMode
The traversal order.
resultSelector
Type: SystemFunc TNode, TResult
The delegate used to project each node of the hierarchy to a result element. It accepts the node as a paramater.

Type Parameters

TNode
The type of the elements in the source hierarchy.
TResult
The type of the elements in the output sequence.

Return Value

Type: IEnumerable TResult
A flat sequence of elements produced from the elements in the source hierarchy.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TNode. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
Flatten Overload


XEnumerable.Flatten(TNode, TResult) Method (IEnumerable(TNode), Func(TNode, IEnumerable(TNode)), TreeTraversalMode, Func(TNode, Int32, TResult))

XEnumerableFlattenTNode, TResult Method (IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode, FuncTNode, Int32, TResult)

Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TResult> Flatten<TNode, TResult>(
    this IEnumerable<TNode> source,
    Func<TNode, IEnumerable<TNode>> childrenSelector,
    TreeTraversalMode traversalMode,
    Func<TNode, int, TResult> resultSelector
)

<ExtensionAttribute>
Public Shared Function Flatten(Of TNode, TResult) (
    source As IEnumerable(Of TNode),
    childrenSelector As Func(Of TNode, IEnumerable(Of TNode)),
    traversalMode As TreeTraversalMode,
    resultSelector As Func(Of TNode, Integer, TResult)
) As IEnumerable(Of TResult)
[<ExtensionAttribute>]
static member Flatten :
        source : IEnumerable<'TNode> *
        childrenSelector : Func<'TNode, IEnumerable<'TNode>> *
        traversalMode : TreeTraversalMode *
        resultSelector : Func<'TNode, int, 'TResult> -> IEnumerable<'TResult>

Parameters

source
Type: System.Collections.GenericIEnumerable TNode
The source hierarchy to flatten.
childrenSelector
Type: SystemFunc TNode, IEnumerable TNode
The delegate used to retrieve the children of an element.
traversalMode
Type: Linq.ExtrasTreeTraversalMode
The traversal order.
resultSelector
Type: SystemFunc TNode, Int32, TResult
The delegate used to project each node of the hierarchy to a result element. It accepts the node and its level as paramaters.

Type Parameters

TNode
The type of the elements in the source hierarchy.
TResult
The type of the elements in the output sequence.

Return Value

Type: IEnumerable TResult
A flat sequence of elements produced from the elements in the source hierarchy.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TNode. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
Flatten Overload


XEnumerable.FullOuterJoin(TLeft, TRight, TKey, TResult) Method

XEnumerableFullOuterJoinTLeft, TRight, TKey, TResult Method

Produces the full outer join of two sequences.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TResult> FullOuterJoin<TLeft, TRight, TKey, TResult>(
    this IEnumerable<TLeft> left,
    IEnumerable<TRight> right,
    Func<TLeft, TKey> leftKeySelector,
    Func<TRight, TKey> rightKeySelector,
    Func<TKey, TLeft, TRight, TResult> resultSelector,
    TLeft defaultLeft = null,
    TRight defaultRight = null,
    IEqualityComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function FullOuterJoin(Of TLeft, TRight, TKey, TResult) (
    left As IEnumerable(Of TLeft),
    right As IEnumerable(Of TRight),
    leftKeySelector As Func(Of TLeft, TKey),
    rightKeySelector As Func(Of TRight, TKey),
    resultSelector As Func(Of TKey, TLeft, TRight, TResult),
    Optional defaultLeft As TLeft = Nothing,
    Optional defaultRight As TRight = Nothing,
    Optional keyComparer As IEqualityComparer(Of TKey) = Nothing
) As IEnumerable(Of TResult)
[<ExtensionAttribute>]
static member FullOuterJoin :
        left : IEnumerable<'TLeft> *
        right : IEnumerable<'TRight> *
        leftKeySelector : Func<'TLeft, 'TKey> *
        rightKeySelector : Func<'TRight, 'TKey> *
        resultSelector : Func<'TKey, 'TLeft, 'TRight, 'TResult> *
        ?defaultLeft : 'TLeft *
        ?defaultRight : 'TRight *
        ?keyComparer : IEqualityComparer<'TKey>
(* Defaults:
        let _defaultLeft = defaultArg defaultLeft null
        let _defaultRight = defaultArg defaultRight null
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TResult>

Parameters

left
Type: System.Collections.GenericIEnumerable TLeft
The left sequence.
right
Type: System.Collections.GenericIEnumerable TRight
The right sequence.
leftKeySelector
Type: SystemFunc TLeft, TKey
The key selector for elements of the left sequence.
rightKeySelector
Type: SystemFunc TRight, TKey
The key selector for elements of the right sequence.
resultSelector
Type: SystemFunc TKey, TLeft, TRight, TResult
A function to produce an output element from two matching elements from the left and right sequences.
defaultLeft (Optional)
Type: TLeft
The default value to use for missing elements in left.
defaultRight (Optional)
Type: TRight
The default value to use for missing elements in right.
keyComparer (Optional)
Type: System.Collections.GenericIEqualityComparer TKey
A comparer to test for equality between the keys.

Type Parameters

TLeft
The type of the elements of left.
TRight
The type of the elements of right.
TKey
The type of the key used to join elements.
TResult
The type of the elements of the output sequence

Return Value

Type: IEnumerable TResult
The full outer join of left and right.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TLeft. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.Generate Method

XEnumerableGenerate Method

Overload List
Name | Description
GenerateTElement(FuncInt32, TElement) | Generates a sequence from an index-based generator function.
GenerateTElement(TElement, FuncTElement, TElement) | Generates a sequence from a seed and a generator function.
Top
See Also

Reference

XEnumerable Class


XEnumerable.Generate(TElement) Method (Func(Int32, TElement))

XEnumerableGenerateTElement Method (FuncInt32, TElement)

Generates a sequence from an index-based generator function.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TElement> Generate<TElement>(
    Func<int, TElement> generator
)

Public Shared Function Generate(Of TElement) (
    generator As Func(Of Integer, TElement)
) As IEnumerable(Of TElement)
static member Generate :
        generator : Func<int, 'TElement> -> IEnumerable<'TElement>

Parameters

generator
Type: SystemFunc Int32, TElement
A generator function that returns an element based on its index.

Type Parameters

TElement
The type of the elements in the sequence.

Return Value

Type: IEnumerable TElement
An sequence of elements generated from their index.
Remarks
The index varies from 0 (inclusive) to int.MaxValue (exclusive), so the output sequence contains int.MaxValue elements.
See Also

Reference

XEnumerable Class
Generate Overload


XEnumerable.Generate(TElement) Method (TElement, Func(TElement, TElement))

XEnumerableGenerateTElement Method (TElement, FuncTElement, TElement)

Generates a sequence from a seed and a generator function.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TElement> Generate<TElement>(
    TElement seed,
    Func<TElement, TElement> generator
)

Public Shared Function Generate(Of TElement) (
    seed As TElement,
    generator As Func(Of TElement, TElement)
) As IEnumerable(Of TElement)
static member Generate :
        seed : 'TElement *
        generator : Func<'TElement, 'TElement> -> IEnumerable<'TElement>

Parameters

seed
Type: TElement
The first element of the sequence.
generator
Type: SystemFunc TElement, TElement
A generator function that returns the next element from the current element.

Type Parameters

TElement
The type of the elements in the sequence.

Return Value

Type: IEnumerable TElement
An infinite sequence of generated elements.
See Also

Reference

XEnumerable Class
Generate Overload


XEnumerable.GroupUntilChanged(TSource) Method

XEnumerableGroupUntilChangedTSource Method

Groups equal adjacent elements from the input sequence based on the specified comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<IGrouping<TSource, TSource>> GroupUntilChanged<TSource>(
    this IEnumerable<TSource> source,
    IEqualityComparer<TSource>? comparer = null
)

<ExtensionAttribute>
Public Shared Function GroupUntilChanged(Of TSource) (
    source As IEnumerable(Of TSource),
    Optional comparer As IEqualityComparer(Of TSource) = Nothing
) As IEnumerable(Of IGrouping(Of TSource, TSource))
[<ExtensionAttribute>]
static member GroupUntilChanged :
        source : IEnumerable<'TSource> *
        ?comparer : IEqualityComparer<'TSource>
(* Defaults:
        let _comparer = defaultArg comparer null
*)
-> IEnumerable<IGrouping<'TSource, 'TSource>>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence of elements to group.
comparer (Optional)
Type: System.Collections.GenericIEqualityComparer TSource
A comparer used to test equality between elements (can be null).

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: IEnumerable IGrouping TSource, TSource
A sequence of groupings of adjacent elements.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.GroupUntilChangedBy(TSource, TKey) Method

XEnumerableGroupUntilChangedByTSource, TKey Method

Groups adjacent elements from the input sequence that have the same value for the specified key, according to the specified key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<IGrouping<TKey, TSource>> GroupUntilChangedBy<TSource, TKey>(
    this IEnumerable<TSource> source,
    Func<TSource, TKey> keySelector,
    IEqualityComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function GroupUntilChangedBy(Of TSource, TKey) (
    source As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    Optional keyComparer As IEqualityComparer(Of TKey) = Nothing
) As IEnumerable(Of IGrouping(Of TKey, TSource))
[<ExtensionAttribute>]
static member GroupUntilChangedBy :
        source : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        ?keyComparer : IEqualityComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<IGrouping<'TKey, 'TSource>>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence of elements to group.
keySelector
Type: SystemFunc TSource, TKey
A delegate that returns the key used to test equality between elements.
keyComparer (Optional)
Type: System.Collections.GenericIEqualityComparer TKey
A comparer used to test equality between keys (can be null).

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the key used for testing equality between elements.

Return Value

Type: IEnumerable IGrouping TKey, TSource
A sequence of groupings of adjacent elements that have the same value for the specified key.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.IndexOf Method

XEnumerableIndexOf Method

Overload List
Name | Description
IndexOfTSource(IEnumerableTSource, FuncTSource, Boolean) | Returns the position of the first element of source that verifies the specified predicate, or -1 if it is not found.
IndexOfTSource(IEnumerableTSource, TSource, IEqualityComparerTSource) | Returns the position of the first occurrence of item in the source sequence, or -1 if it is not found.
Top
See Also

Reference

XEnumerable Class


XEnumerable.IndexOf(TSource) Method (IEnumerable(TSource), Func(TSource, Boolean))

XEnumerableIndexOfTSource Method (IEnumerableTSource, FuncTSource, Boolean)

Returns the position of the first element of source that verifies the specified predicate, or -1 if it is not found.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static int IndexOf<TSource>(
    this IEnumerable<TSource> source,
    Func<TSource, bool> predicate
)

<ExtensionAttribute>
Public Shared Function IndexOf(Of TSource) (
    source As IEnumerable(Of TSource),
    predicate As Func(Of TSource, Boolean)
) As Integer
[<ExtensionAttribute>]
static member IndexOf :
        source : IEnumerable<'TSource> *
        predicate : Func<'TSource, bool> -> int

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to search for a matching element.
predicate
Type: SystemFunc TSource, Boolean
The predicate that is tested against each element.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: Int32
The zero-based index of the first element that verifies the predicate, or -1 if no element verifies the predicate.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
IndexOf Overload


XEnumerable.IndexOf(TSource) Method (IEnumerable(TSource), TSource, IEqualityComparer(TSource))

XEnumerableIndexOfTSource Method (IEnumerableTSource, TSource, IEqualityComparerTSource)

Returns the position of the first occurrence of item in the source sequence, or -1 if it is not found.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static int IndexOf<TSource>(
    this IEnumerable<TSource> source,
    TSource item,
    IEqualityComparer<TSource>? comparer = null
)

<ExtensionAttribute>
Public Shared Function IndexOf(Of TSource) (
    source As IEnumerable(Of TSource),
    item As TSource,
    Optional comparer As IEqualityComparer(Of TSource) = Nothing
) As Integer
[<ExtensionAttribute>]
static member IndexOf :
        source : IEnumerable<'TSource> *
        item : 'TSource *
        ?comparer : IEqualityComparer<'TSource>
(* Defaults:
        let _comparer = defaultArg comparer null
*)
-> int

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to search for item.
item
Type: TSource
The element to find the index of.
comparer (Optional)
Type: System.Collections.GenericIEqualityComparer TSource
The comparer to use to test for equality between elements.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: Int32
The zero-based index of the first occurrence of item if it is found; otherwise, -1.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
IndexOf Overload


XEnumerable.IndexOfSubstring(TSource) Method

XEnumerableIndexOfSubstringTSource Method

Returns the position of the first occurrence of the specified substring in the source sequence, or -1 if it is not found.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static int IndexOfSubstring<TSource>(
    this IEnumerable<TSource> source,
    IEnumerable<TSource> substring,
    IEqualityComparer<TSource>? comparer = null
)

<ExtensionAttribute>
Public Shared Function IndexOfSubstring(Of TSource) (
    source As IEnumerable(Of TSource),
    substring As IEnumerable(Of TSource),
    Optional comparer As IEqualityComparer(Of TSource) = Nothing
) As Integer
[<ExtensionAttribute>]
static member IndexOfSubstring :
        source : IEnumerable<'TSource> *
        substring : IEnumerable<'TSource> *
        ?comparer : IEqualityComparer<'TSource>
(* Defaults:
        let _comparer = defaultArg comparer null
*)
-> int

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to search for a substring.
substring
Type: System.Collections.GenericIEnumerable TSource
The substring to search.
comparer (Optional)
Type: System.Collections.GenericIEqualityComparer TSource
The comparer to use to test equality between elements.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: Int32
The zero-based index of the start of the first occurrence of substring if it's found; otherwise, -1.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
Here the word substring is to be understood in the mathematical sense; it's not related to character strings. See the definition on Wikipedia.
See Also

Reference

XEnumerable Class


XEnumerable.IntersectBy(TSource, TKey) Method

XEnumerableIntersectByTSource, TKey Method

Produces the set intersection of two sequences, based on the specified key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TSource> IntersectBy<TSource, TKey>(
    this IEnumerable<TSource> source,
    IEnumerable<TSource> other,
    Func<TSource, TKey> keySelector,
    IEqualityComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function IntersectBy(Of TSource, TKey) (
    source As IEnumerable(Of TSource),
    other As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    Optional keyComparer As IEqualityComparer(Of TKey) = Nothing
) As IEnumerable(Of TSource)
[<ExtensionAttribute>]
static member IntersectBy :
        source : IEnumerable<'TSource> *
        other : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        ?keyComparer : IEqualityComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The first sequence.
other
Type: System.Collections.GenericIEnumerable TSource
The second sequence.
keySelector
Type: SystemFunc TSource, TKey
A delegate that returns the key used to test for equality between elements.
keyComparer (Optional)
Type: System.Collections.GenericIEqualityComparer TKey
A comparer used to test for equality between keys.

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the key used to test for equality between elements.

Return Value

Type: IEnumerable TSource
The set intersection of source and other, based on the specified key and key comparer.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.IsNullOrEmpty Method

XEnumerableIsNullOrEmpty Method

Overload List
Name | Description
IsNullOrEmpty(IEnumerable) | Indicates whether a sequence is null or empty.
IsNullOrEmptyTSource(IEnumerableTSource) | Indicates whether a sequence is null or empty.
Top
See Also

Reference

XEnumerable Class


XEnumerable.IsNullOrEmpty Method (IEnumerable)

XEnumerableIsNullOrEmpty Method (IEnumerable)

Indicates whether a sequence is null or empty.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static bool IsNullOrEmpty(
    this IEnumerable? source
)
<ExtensionAttribute>
Public Shared Function IsNullOrEmpty (
    source As IEnumerable
) As Boolean
[<ExtensionAttribute>]
static member IsNullOrEmpty :
        source : IEnumerable -> bool

Parameters

source
Type: System.CollectionsIEnumerable
The sequence to check.

Return Value

Type: Boolean
true if the source sequence is null or empty; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
IsNullOrEmpty Overload


XEnumerable.IsNullOrEmpty(TSource) Method (IEnumerable(TSource))

XEnumerableIsNullOrEmptyTSource Method (IEnumerableTSource)

Indicates whether a sequence is null or empty.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static bool IsNullOrEmpty<TSource>(
    this IEnumerable<TSource>? source
)

<ExtensionAttribute>
Public Shared Function IsNullOrEmpty(Of TSource) (
    source As IEnumerable(Of TSource)
) As Boolean
[<ExtensionAttribute>]
static member IsNullOrEmpty :
        source : IEnumerable<'TSource> -> bool

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to check.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: Boolean
true if the source sequence is null or empty; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
IsNullOrEmpty Overload


XEnumerable.LastIndexOf Method

XEnumerableLastIndexOf Method

Overload List
Name | Description
LastIndexOfTSource(IEnumerableTSource, FuncTSource, Boolean) | Returns the position of the last element of source that verifies the specified predicate, or -1 if it is not found.
LastIndexOfTSource(IEnumerableTSource, TSource, IEqualityComparerTSource) | Returns the position of the last occurrence of item in the source sequence, or -1 if it is not found.
Top
See Also

Reference

XEnumerable Class


XEnumerable.LastIndexOf(TSource) Method (IEnumerable(TSource), Func(TSource, Boolean))

XEnumerableLastIndexOfTSource Method (IEnumerableTSource, FuncTSource, Boolean)

Returns the position of the last element of source that verifies the specified predicate, or -1 if it is not found.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static int LastIndexOf<TSource>(
    this IEnumerable<TSource> source,
    Func<TSource, bool> predicate
)

<ExtensionAttribute>
Public Shared Function LastIndexOf(Of TSource) (
    source As IEnumerable(Of TSource),
    predicate As Func(Of TSource, Boolean)
) As Integer
[<ExtensionAttribute>]
static member LastIndexOf :
        source : IEnumerable<'TSource> *
        predicate : Func<'TSource, bool> -> int

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to search for a matching element.
predicate
Type: SystemFunc TSource, Boolean
The predicate that is tested against each element.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: Int32
The zero-based index of the last element that verifies the predicate, or -1 if no element verifies the predicate.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
LastIndexOf Overload


XEnumerable.LastIndexOf(TSource) Method (IEnumerable(TSource), TSource, IEqualityComparer(TSource))

XEnumerableLastIndexOfTSource Method (IEnumerableTSource, TSource, IEqualityComparerTSource)

Returns the position of the last occurrence of item in the source sequence, or -1 if it is not found.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static int LastIndexOf<TSource>(
    this IEnumerable<TSource> source,
    TSource item,
    IEqualityComparer<TSource>? comparer = null
)

<ExtensionAttribute>
Public Shared Function LastIndexOf(Of TSource) (
    source As IEnumerable(Of TSource),
    item As TSource,
    Optional comparer As IEqualityComparer(Of TSource) = Nothing
) As Integer
[<ExtensionAttribute>]
static member LastIndexOf :
        source : IEnumerable<'TSource> *
        item : 'TSource *
        ?comparer : IEqualityComparer<'TSource>
(* Defaults:
        let _comparer = defaultArg comparer null
*)
-> int

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to search for item.
item
Type: TSource
The element to find the index of.
comparer (Optional)
Type: System.Collections.GenericIEqualityComparer TSource
The comparer to use to test for equality between elements.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: Int32
The zero-based index of the last occurrence of item if it is found; otherwise, -1.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
LastIndexOf Overload


XEnumerable.LastOrDefault Method

XEnumerableLastOrDefault Method

Overload List
Name | Description
LastOrDefaultTSource(IEnumerableTSource, TSource) | Returns the last element of a sequence or the specified default value if the sequence contains no elements.
LastOrDefaultTSource(IEnumerableTSource, FuncTSource, Boolean, TSource) | Returns the last element of the sequence that satisfies a condition or the specied default value if no such element is found.
Top
See Also

Reference

XEnumerable Class


XEnumerable.LastOrDefault(TSource) Method (IEnumerable(TSource), TSource)

XEnumerableLastOrDefaultTSource Method (IEnumerableTSource, TSource)

Returns the last element of a sequence or the specified default value if the sequence contains no elements.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static TSource LastOrDefault<TSource>(
    this IEnumerable<TSource> source,
    TSource defaultValue
)

<ExtensionAttribute>
Public Shared Function LastOrDefault(Of TSource) (
    source As IEnumerable(Of TSource),
    defaultValue As TSource
) As TSource
[<ExtensionAttribute>]
static member LastOrDefault :
        source : IEnumerable<'TSource> *
        defaultValue : 'TSource -> 'TSource

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return the last element of.
defaultValue
Type: TSource
The default value to return if the sequence is empty.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: TSource
defaultValue if source is empty; otherwise, the last element in source.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
LastOrDefault Overload


XEnumerable.LastOrDefault(TSource) Method (IEnumerable(TSource), Func(TSource, Boolean), TSource)

XEnumerableLastOrDefaultTSource Method (IEnumerableTSource, FuncTSource, Boolean, TSource)

Returns the last element of the sequence that satisfies a condition or the specied default value if no such element is found.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static TSource LastOrDefault<TSource>(
    this IEnumerable<TSource> source,
    Func<TSource, bool> predicate,
    TSource defaultValue
)

<ExtensionAttribute>
Public Shared Function LastOrDefault(Of TSource) (
    source As IEnumerable(Of TSource),
    predicate As Func(Of TSource, Boolean),
    defaultValue As TSource
) As TSource
[<ExtensionAttribute>]
static member LastOrDefault :
        source : IEnumerable<'TSource> *
        predicate : Func<'TSource, bool> *
        defaultValue : 'TSource -> 'TSource

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return an element from.
predicate
Type: SystemFunc TSource, Boolean
A function to test each element for a condition.
defaultValue
Type: TSource
The default value to return if no matching element is found.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: TSource
defaultValue if source is empty or if no element passes the test specified by predicate; otherwise, the last element in source that passes the test specified by predicate.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
LastOrDefault Overload


XEnumerable.LeftOuterJoin(TLeft, TRight, TKey, TResult) Method

XEnumerableLeftOuterJoinTLeft, TRight, TKey, TResult Method

Produces the left outer join of two sequences.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TResult> LeftOuterJoin<TLeft, TRight, TKey, TResult>(
    this IEnumerable<TLeft> left,
    IEnumerable<TRight> right,
    Func<TLeft, TKey> leftKeySelector,
    Func<TRight, TKey> rightKeySelector,
    Func<TLeft, TRight, TResult> resultSelector,
    TRight defaultRight = null,
    IEqualityComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function LeftOuterJoin(Of TLeft, TRight, TKey, TResult) (
    left As IEnumerable(Of TLeft),
    right As IEnumerable(Of TRight),
    leftKeySelector As Func(Of TLeft, TKey),
    rightKeySelector As Func(Of TRight, TKey),
    resultSelector As Func(Of TLeft, TRight, TResult),
    Optional defaultRight As TRight = Nothing,
    Optional keyComparer As IEqualityComparer(Of TKey) = Nothing
) As IEnumerable(Of TResult)
[<ExtensionAttribute>]
static member LeftOuterJoin :
        left : IEnumerable<'TLeft> *
        right : IEnumerable<'TRight> *
        leftKeySelector : Func<'TLeft, 'TKey> *
        rightKeySelector : Func<'TRight, 'TKey> *
        resultSelector : Func<'TLeft, 'TRight, 'TResult> *
        ?defaultRight : 'TRight *
        ?keyComparer : IEqualityComparer<'TKey>
(* Defaults:
        let _defaultRight = defaultArg defaultRight null
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TResult>

Parameters

left
Type: System.Collections.GenericIEnumerable TLeft
The left sequence.
right
Type: System.Collections.GenericIEnumerable TRight
The right sequence.
leftKeySelector
Type: SystemFunc TLeft, TKey
The key selector for elements of the left sequence.
rightKeySelector
Type: SystemFunc TRight, TKey
The key selector for elements of the right sequence.
resultSelector
Type: SystemFunc TLeft, TRight, TResult
A function to produce an output element from two matching elements from the left and right sequences.
defaultRight (Optional)
Type: TRight
The default value to use for missing elements in right.
keyComparer (Optional)
Type: System.Collections.GenericIEqualityComparer TKey
A comparer to test for equality between the keys.

Type Parameters

TLeft
The type of the elements of left.
TRight
The type of the elements of right.
TKey
The type of the key used to join elements.
TResult
The type of the elements of the output sequence

Return Value

Type: IEnumerable TResult
The left outer join of left and right.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TLeft. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.Max(TSource) Method

XEnumerableMaxTSource Method

Returns the maximum element of the sequence according to the specified comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static TSource Max<TSource>(
    this IEnumerable<TSource> source,
    IComparer<TSource> comparer
)

<ExtensionAttribute>
Public Shared Function Max(Of TSource) (
    source As IEnumerable(Of TSource),
    comparer As IComparer(Of TSource)
) As TSource
[<ExtensionAttribute>]
static member Max :
        source : IEnumerable<'TSource> *
        comparer : IComparer<'TSource> -> 'TSource

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return the maximum element from.
comparer
Type: System.Collections.GenericIComparer TSource
The comparer used to compare elements.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: TSource
The maximum element according to the specified comparer.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
If TSource is a reference type or nullable value type, null values are ignored, unless the sequence consists entirely of null values (in which case the method will return null). If TSource is a reference type or nullable value type, and the sequence is empty, the method will return null. If TSource is a value type, and the sequence is empty, the method will throw an InvalidOperationException.
See Also

Reference

XEnumerable Class


XEnumerable.MaxBy(TSource, TKey) Method

XEnumerableMaxByTSource, TKey Method

Returns the element of the sequence that has the maximum value for the specified key.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static TSource MaxBy<TSource, TKey>(
    this IEnumerable<TSource> source,
    Func<TSource, TKey> keySelector,
    IComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function MaxBy(Of TSource, TKey) (
    source As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    Optional keyComparer As IComparer(Of TKey) = Nothing
) As TSource
[<ExtensionAttribute>]
static member MaxBy :
        source : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        ?keyComparer : IComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> 'TSource

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return an element from.
keySelector
Type: SystemFunc TSource, TKey
A delegate that returns the key used to compare elements.
keyComparer (Optional)
Type: System.Collections.GenericIComparer TKey
A comparer to compare the keys.

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the key used to compare elements.

Return Value

Type: TSource
The element of source that has the maximum value for the specified key.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
If TKey is a reference type or nullable value type, null keys are ignored, unless the sequence consists entirely of items with null keys (in which case the method will return null). If TKey is a reference type or nullable value type, and the sequence is empty, the method will return null. If TKey is a value type, and the sequence is empty, the method will throw an InvalidOperationException.
See Also

Reference

XEnumerable Class


XEnumerable.Min(TSource) Method

XEnumerableMinTSource Method

Returns the minimum element of the sequence according to the specified comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static TSource Min<TSource>(
    this IEnumerable<TSource> source,
    IComparer<TSource> comparer
)

<ExtensionAttribute>
Public Shared Function Min(Of TSource) (
    source As IEnumerable(Of TSource),
    comparer As IComparer(Of TSource)
) As TSource
[<ExtensionAttribute>]
static member Min :
        source : IEnumerable<'TSource> *
        comparer : IComparer<'TSource> -> 'TSource

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return the minimum element from.
comparer
Type: System.Collections.GenericIComparer TSource
The comparer used to compare elements.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: TSource
The minimum element according to the specified comparer.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
If TSource is a reference type or nullable value type, null values are ignored, unless the sequence consists entirely of null values (in which case the method will return null). If TSource is a reference type or nullable value type, and the sequence is empty, the method will return null. If TSource is a value type, and the sequence is empty, the method will throw an InvalidOperationException.
See Also

Reference

XEnumerable Class


XEnumerable.MinBy(TSource, TKey) Method

XEnumerableMinByTSource, TKey Method

Returns the element of the sequence that has the minimum value for the specified key.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static TSource MinBy<TSource, TKey>(
    this IEnumerable<TSource> source,
    Func<TSource, TKey> keySelector,
    IComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function MinBy(Of TSource, TKey) (
    source As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    Optional keyComparer As IComparer(Of TKey) = Nothing
) As TSource
[<ExtensionAttribute>]
static member MinBy :
        source : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        ?keyComparer : IComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> 'TSource

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return an element from.
keySelector
Type: SystemFunc TSource, TKey
A delegate that returns the key used to compare elements.
keyComparer (Optional)
Type: System.Collections.GenericIComparer TKey
A comparer to compare the keys.

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the key used to compare elements.

Return Value

Type: TSource
The element of source that has the minimum value for the specified key.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
If TKey is a reference type or nullable value type, null keys are ignored, unless the sequence consists entirely of items with null keys (in which case the method will return null). If TKey is a reference type or nullable value type, and the sequence is empty, the method will return null. If TKey is a value type, and the sequence is empty, the method will throw an InvalidOperationException.
See Also

Reference

XEnumerable Class


XEnumerable.None Method

XEnumerableNone Method

Overload List
Name | Description
NoneTSource(IEnumerableTSource) | Checks if the sequence is empty.
NoneTSource(IEnumerableTSource, FuncTSource, Boolean) | Checks if the sequence contains no element that matches the predicate.
Top
See Also

Reference

XEnumerable Class


XEnumerable.None(TSource) Method (IEnumerable(TSource))

XEnumerableNoneTSource Method (IEnumerableTSource)

Checks if the sequence is empty.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static bool None<TSource>(
    this IEnumerable<TSource> source
)

<ExtensionAttribute>
Public Shared Function None(Of TSource) (
    source As IEnumerable(Of TSource)
) As Boolean
[<ExtensionAttribute>]
static member None :
        source : IEnumerable<'TSource> -> bool

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to check for emptyness.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: Boolean
true if the sequence is empty, false if it contains at least one element.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
None Overload


XEnumerable.None(TSource) Method (IEnumerable(TSource), Func(TSource, Boolean))

XEnumerableNoneTSource Method (IEnumerableTSource, FuncTSource, Boolean)

Checks if the sequence contains no element that matches the predicate.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static bool None<TSource>(
    this IEnumerable<TSource> source,
    Func<TSource, bool> predicate
)

<ExtensionAttribute>
Public Shared Function None(Of TSource) (
    source As IEnumerable(Of TSource),
    predicate As Func(Of TSource, Boolean)
) As Boolean
[<ExtensionAttribute>]
static member None :
        source : IEnumerable<'TSource> *
        predicate : Func<'TSource, bool> -> bool

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to check.
predicate
Type: SystemFunc TSource, Boolean
The predicate to verify against each element in the sequence.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: Boolean
true if no element matches the predicate, false if at least one element matches the predicate.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
None Overload


XEnumerable.Prepend(TSource) Method

XEnumerablePrependTSource Method

Note: This API is now obsolete.

Prepends the specified element to the specified sequence.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
[ObsoleteAttribute("This feature is now implemented directly in System.Linq. Please use Enumerable.Prepend instead")]
public static IEnumerable<TSource> Prepend<TSource>(
    IEnumerable<TSource> source,
    TSource item
)

<ObsoleteAttribute("This feature is now implemented directly in System.Linq. Please use Enumerable.Prepend instead")>
Public Shared Function Prepend(Of TSource) (
    source As IEnumerable(Of TSource),
    item As TSource
) As IEnumerable(Of TSource)
[<ObsoleteAttribute("This feature is now implemented directly in System.Linq. Please use Enumerable.Prepend instead")>]
static member Prepend :
        source : IEnumerable<'TSource> *
        item : 'TSource -> IEnumerable<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to prepend an element to.
item
Type: TSource
The element to prepend.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: IEnumerable TSource
The source sequence preceded by the prepended element.
Remarks
Linq already has this method in .NET Core, .NET Framework 4.7.1 and higher, and .NET Standard 1.6 and higher, so it's not included in Linq.Extras for these frameworks.
See Also

Reference

XEnumerable Class


XEnumerable.RankBy(TSource, TKey, TResult) Method

XEnumerableRankByTSource, TKey, TResult Method

Associates an ascending rank to each element of the input sequence, based on the specified key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TResult> RankBy<TSource, TKey, TResult>(
    this IEnumerable<TSource> source,
    Func<TSource, TKey> keySelector,
    Func<TSource, int, TResult> resultSelector,
    IComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function RankBy(Of TSource, TKey, TResult) (
    source As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    resultSelector As Func(Of TSource, Integer, TResult),
    Optional keyComparer As IComparer(Of TKey) = Nothing
) As IEnumerable(Of TResult)
[<ExtensionAttribute>]
static member RankBy :
        source : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        resultSelector : Func<'TSource, int, 'TResult> *
        ?keyComparer : IComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TResult>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The input sequence.
keySelector
Type: SystemFunc TSource, TKey
A function that returns the key for each element.
resultSelector
Type: SystemFunc TSource, Int32, TResult
A projection that takes an element and its rank and returns an output element.
keyComparer (Optional)
Type: System.Collections.GenericIComparer TKey
The comparer used to compare the keys.

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the key used to compare elements.
TResult
The type of the elements in the output sequence.

Return Value

Type: IEnumerable TResult
A sequence of elements associated with their rank using the result selector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
This method produces a sparse ranking, i.e. elements with equal rank produce "holes" in the ranks. In the following example, there are two elements with rank 2, so there is no element with rank 3; the rank of the next element is 4.
Rank | Value
1 | A
2 | B
2 | B
4 | C
See Also

Reference

XEnumerable Class


XEnumerable.RankByDescending(TSource, TKey, TResult) Method

XEnumerableRankByDescendingTSource, TKey, TResult Method

Associates a descending rank to each element of the input sequence, based on the specified key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TResult> RankByDescending<TSource, TKey, TResult>(
    this IEnumerable<TSource> source,
    Func<TSource, TKey> keySelector,
    Func<TSource, int, TResult> resultSelector,
    IComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function RankByDescending(Of TSource, TKey, TResult) (
    source As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    resultSelector As Func(Of TSource, Integer, TResult),
    Optional keyComparer As IComparer(Of TKey) = Nothing
) As IEnumerable(Of TResult)
[<ExtensionAttribute>]
static member RankByDescending :
        source : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        resultSelector : Func<'TSource, int, 'TResult> *
        ?keyComparer : IComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TResult>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The input sequence.
keySelector
Type: SystemFunc TSource, TKey
A function that returns the key for each element.
resultSelector
Type: SystemFunc TSource, Int32, TResult
A projection that takes an element and its rank and returns an output element.
keyComparer (Optional)
Type: System.Collections.GenericIComparer TKey
The comparer used to compare the keys.

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the key used to compare elements.
TResult
The type of the elements in the output sequence.

Return Value

Type: IEnumerable TResult
A sequence of elements associated with their rank using the result selector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
This method produces a sparse ranking, i.e. elements with equal rank produce "holes" in the ranks. See RankByTSource, TKey, TResult(IEnumerableTSource, FuncTSource, TKey, FuncTSource, Int32, TResult, IComparerTKey) for an example.
See Also

Reference

XEnumerable Class


XEnumerable.RightOuterJoin(TLeft, TRight, TKey, TResult) Method

XEnumerableRightOuterJoinTLeft, TRight, TKey, TResult Method

Produces the right outer join of two sequences.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TResult> RightOuterJoin<TLeft, TRight, TKey, TResult>(
    this IEnumerable<TLeft> left,
    IEnumerable<TRight> right,
    Func<TLeft, TKey> leftKeySelector,
    Func<TRight, TKey> rightKeySelector,
    Func<TLeft, TRight, TResult> resultSelector,
    TLeft defaultLeft = null,
    IEqualityComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function RightOuterJoin(Of TLeft, TRight, TKey, TResult) (
    left As IEnumerable(Of TLeft),
    right As IEnumerable(Of TRight),
    leftKeySelector As Func(Of TLeft, TKey),
    rightKeySelector As Func(Of TRight, TKey),
    resultSelector As Func(Of TLeft, TRight, TResult),
    Optional defaultLeft As TLeft = Nothing,
    Optional keyComparer As IEqualityComparer(Of TKey) = Nothing
) As IEnumerable(Of TResult)
[<ExtensionAttribute>]
static member RightOuterJoin :
        left : IEnumerable<'TLeft> *
        right : IEnumerable<'TRight> *
        leftKeySelector : Func<'TLeft, 'TKey> *
        rightKeySelector : Func<'TRight, 'TKey> *
        resultSelector : Func<'TLeft, 'TRight, 'TResult> *
        ?defaultLeft : 'TLeft *
        ?keyComparer : IEqualityComparer<'TKey>
(* Defaults:
        let _defaultLeft = defaultArg defaultLeft null
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TResult>

Parameters

left
Type: System.Collections.GenericIEnumerable TLeft
The left sequence.
right
Type: System.Collections.GenericIEnumerable TRight
The right sequence.
leftKeySelector
Type: SystemFunc TLeft, TKey
The key selector for elements of the left sequence.
rightKeySelector
Type: SystemFunc TRight, TKey
The key selector for elements of the right sequence.
resultSelector
Type: SystemFunc TLeft, TRight, TResult
A function to produce an output element from two matching elements from the left and right sequences.
defaultLeft (Optional)
Type: TLeft
The default value to use for missing elements in left.
keyComparer (Optional)
Type: System.Collections.GenericIEqualityComparer TKey
A comparer to test for equality between the keys.

Type Parameters

TLeft
The type of the elements of left.
TRight
The type of the elements of right.
TKey
The type of the key used to join elements.
TResult
The type of the elements of the output sequence

Return Value

Type: IEnumerable TResult
The right outer join of left and right.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TLeft. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.SequenceEqualBy(TSource, TKey) Method

XEnumerableSequenceEqualByTSource, TKey Method

Determines whether two sequences are equal by comparing their elements using the specified key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static bool SequenceEqualBy<TSource, TKey>(
    this IEnumerable<TSource> source,
    IEnumerable<TSource> other,
    Func<TSource, TKey> keySelector,
    IEqualityComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function SequenceEqualBy(Of TSource, TKey) (
    source As IEnumerable(Of TSource),
    other As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    Optional keyComparer As IEqualityComparer(Of TKey) = Nothing
) As Boolean
[<ExtensionAttribute>]
static member SequenceEqualBy :
        source : IEnumerable<'TSource> *
        other : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        ?keyComparer : IEqualityComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> bool

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The first sequence to compare.
other
Type: System.Collections.GenericIEnumerable TSource
The second sequence to compare.
keySelector
Type: SystemFunc TSource, TKey
A function that returns the key to use to test for equality between elements.
keyComparer (Optional)
Type: System.Collections.GenericIEqualityComparer TKey
A comparer used to compare the keys.

Type Parameters

TSource
The type of the elements of source and other.
TKey
The type of the key used to test for equality between elements.

Return Value

Type: Boolean
true if the two source sequences are of equal length and their corresponding elements compare equal according to the key and key comparer; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.SingleOrDefault Method

XEnumerableSingleOrDefault Method

Overload List
Name | Description
SingleOrDefaultTSource(IEnumerableTSource, TSource) | Returns the only element of a sequence, or the specified default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.
SingleOrDefaultTSource(IEnumerableTSource, FuncTSource, Boolean, TSource) | Returns the only element of a sequence that satisfies a specified condition, or the specified default value if no such element exists; this method throws an exception if more than one element satisfies the condition.
Top
See Also

Reference

XEnumerable Class


XEnumerable.SingleOrDefault(TSource) Method (IEnumerable(TSource), TSource)

XEnumerableSingleOrDefaultTSource Method (IEnumerableTSource, TSource)

Returns the only element of a sequence, or the specified default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static TSource SingleOrDefault<TSource>(
    this IEnumerable<TSource> source,
    TSource defaultValue
)

<ExtensionAttribute>
Public Shared Function SingleOrDefault(Of TSource) (
    source As IEnumerable(Of TSource),
    defaultValue As TSource
) As TSource
[<ExtensionAttribute>]
static member SingleOrDefault :
        source : IEnumerable<'TSource> *
        defaultValue : 'TSource -> 'TSource

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return the single element of.
defaultValue
Type: TSource
The default value to return if the sequence is empty.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: TSource
The single element of the input sequence, or defaultValue if the sequence contains no elements.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
SingleOrDefault Overload


XEnumerable.SingleOrDefault(TSource) Method (IEnumerable(TSource), Func(TSource, Boolean), TSource)

XEnumerableSingleOrDefaultTSource Method (IEnumerableTSource, FuncTSource, Boolean, TSource)

Returns the only element of a sequence that satisfies a specified condition, or the specified default value if no such element exists; this method throws an exception if more than one element satisfies the condition.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static TSource SingleOrDefault<TSource>(
    this IEnumerable<TSource> source,
    Func<TSource, bool> predicate,
    TSource defaultValue
)

<ExtensionAttribute>
Public Shared Function SingleOrDefault(Of TSource) (
    source As IEnumerable(Of TSource),
    predicate As Func(Of TSource, Boolean),
    defaultValue As TSource
) As TSource
[<ExtensionAttribute>]
static member SingleOrDefault :
        source : IEnumerable<'TSource> *
        predicate : Func<'TSource, bool> *
        defaultValue : 'TSource -> 'TSource

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence to return a single element from.
predicate
Type: SystemFunc TSource, Boolean
A function to test an element for a condition.
defaultValue
Type: TSource
The default value to return if the no element matches the predicate.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: TSource
The single element of the input sequence that satisfies the condition, or defaultValue if no such element is found.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
SingleOrDefault Overload


XEnumerable.ToArray(TSource) Method

XEnumerableToArrayTSource Method

Creates an array from the elements in the source sequence. Unlike ToArrayTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate an array of the right size from the start, hence suppressing the need for subsequent allocations and improving performance.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static TSource[] ToArray<TSource>(
    this IEnumerable<TSource> source,
    int count
)

<ExtensionAttribute>
Public Shared Function ToArray(Of TSource) (
    source As IEnumerable(Of TSource),
    count As Integer
) As TSource()
[<ExtensionAttribute>]
static member ToArray :
        source : IEnumerable<'TSource> *
        count : int -> 'TSource[]

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence containing the elements to put in the array.
count
Type: SystemInt32
The number of elements in source.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: TSource
An array containing the same elements as the source sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
Exception | Condition
IndexOutOfRangeException | The source sequence contains more than count elements.
Remarks
ToArrayTSource(IEnumerableTSource) doesn't know the number of elements in the source sequence (unless it implements ICollectionT), so it starts by allocating a small array, copies elements into it until it's full, then allocates a new array with twice the initial size, copies the data from the previous array, and continues until all elements have been copied; then it needs to trim the array, by allocating yet another array with the correct size and copying the data into it. This is very inefficient because of the many allocations and copies. This method allows you to supply the number of elements, if you know it, so that it can make a single array allocation of exactly the right size.
See Also

Reference

XEnumerable Class


XEnumerable.ToHashSet(TSource) Method

XEnumerableToHashSetTSource Method

Note: This API is now obsolete.

Creates a hash set from the elements in the source sequence.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
[ObsoleteAttribute("This feature is now implemented directly in System.Linq. Please use Enumerable.ToHashSet instead")]
public static HashSet<TSource> ToHashSet<TSource>(
    IEnumerable<TSource> source,
    IEqualityComparer<TSource>? comparer = null
)

<ObsoleteAttribute("This feature is now implemented directly in System.Linq. Please use Enumerable.ToHashSet instead")>
Public Shared Function ToHashSet(Of TSource) (
    source As IEnumerable(Of TSource),
    Optional comparer As IEqualityComparer(Of TSource) = Nothing
) As HashSet(Of TSource)
[<ObsoleteAttribute("This feature is now implemented directly in System.Linq. Please use Enumerable.ToHashSet instead")>]
static member ToHashSet :
        source : IEnumerable<'TSource> *
        ?comparer : IEqualityComparer<'TSource>
(* Defaults:
        let _comparer = defaultArg comparer null
*)
-> HashSet<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence containing the elements to put in the hash set.
comparer (Optional)
Type: System.Collections.GenericIEqualityComparer TSource
A comparer to test for equality between elements.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: HashSet TSource
A hash set containing the same elements as the source sequence.
Remarks
Since a hash set cannot contain duplicates, duplicate elements from the source sequence will not be included in the hash set.
See Also

Reference

XEnumerable Class


XEnumerable.ToHierarchy(TSource, TId) Method

XEnumerableToHierarchyTSource, TId Method

Builds a hierarchy from a flat sequence of elements, based on an Id/ParentId relation.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<INode<TSource>> ToHierarchy<TSource, TId>(
    this IEnumerable<TSource> source,
    Func<TSource, TId> idSelector,
    Func<TSource, TId> parentIdSelector,
    TId rootParentId = null
)

<ExtensionAttribute>
Public Shared Function ToHierarchy(Of TSource, TId) (
    source As IEnumerable(Of TSource),
    idSelector As Func(Of TSource, TId),
    parentIdSelector As Func(Of TSource, TId),
    Optional rootParentId As TId = Nothing
) As IEnumerable(Of INode(Of TSource))
[<ExtensionAttribute>]
static member ToHierarchy :
        source : IEnumerable<'TSource> *
        idSelector : Func<'TSource, 'TId> *
        parentIdSelector : Func<'TSource, 'TId> *
        ?rootParentId : 'TId
(* Defaults:
        let _rootParentId = defaultArg rootParentId null
*)
-> IEnumerable<INode<'TSource>>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The flat sequence of elements to build a hierarchy from.
idSelector
Type: SystemFunc TSource, TId
A function that returns the id of an element.
parentIdSelector
Type: SystemFunc TSource, TId
A function that returns the parent id of an element.
rootParentId (Optional)
Type: TId
The parent id of the root elements (0 or -1, for instance).

Type Parameters

TSource
The type of the elements in source.
TId
The type of the elements' identifier.

Return Value

Type: IEnumerable INode TSource
A sequence containing the root nodes of the hierarchy. Each node in the hierarchy has a collection of child nodes and a link to the parent node.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.ToLinkedList(TSource) Method

XEnumerableToLinkedListTSource Method

Creates a linked list from the elements in the source sequence.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static LinkedList<TSource> ToLinkedList<TSource>(
    this IEnumerable<TSource> source
)

<ExtensionAttribute>
Public Shared Function ToLinkedList(Of TSource) (
    source As IEnumerable(Of TSource)
) As LinkedList(Of TSource)
[<ExtensionAttribute>]
static member ToLinkedList :
        source : IEnumerable<'TSource> -> LinkedList<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence containing the elements to put in the linked list.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: LinkedList TSource
A linked list containing the same elements as the source sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.ToList(TSource) Method

XEnumerableToListTSource Method

Creates a ListT from the elements in the source sequence. Unlike ToListTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate a list with sufficient capacity, hence suppressing the need for subsequent allocations, and improving performance.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static List<TSource> ToList<TSource>(
    this IEnumerable<TSource> source,
    int count
)

<ExtensionAttribute>
Public Shared Function ToList(Of TSource) (
    source As IEnumerable(Of TSource),
    count As Integer
) As List(Of TSource)
[<ExtensionAttribute>]
static member ToList :
        source : IEnumerable<'TSource> *
        count : int -> List<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence containing the elements to put in the list.
count
Type: SystemInt32
The number of elements in source.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: List TSource
A ListT containing the same elements as the source sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
ToListTSource(IEnumerableTSource) doesn't know the number of elements in the source sequence (unless it implements ICollectionT), so it starts with an empty collection and adds the items to it; every time the list's capacity is exceeded, it needs to resize itself, which involves allocating a new array and copying the existing data into it (all of this is actually done in the ListT class). This is very inefficient, because of the many allocations and copies. This method allows you to supply the number of elements, if you know it, so that it can allocate a list with sufficient capacity and avoid subsequent allocations.
See Also

Reference

XEnumerable Class


XEnumerable.ToQueue(TSource) Method

XEnumerableToQueueTSource Method

Creates a queue from the elements in the source sequence.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static Queue<TSource> ToQueue<TSource>(
    this IEnumerable<TSource> source
)

<ExtensionAttribute>
Public Shared Function ToQueue(Of TSource) (
    source As IEnumerable(Of TSource)
) As Queue(Of TSource)
[<ExtensionAttribute>]
static member ToQueue :
        source : IEnumerable<'TSource> -> Queue<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence containing the elements to put in the queue.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: Queue TSource
A queue containing the same elements as the source sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.ToStack(TSource) Method

XEnumerableToStackTSource Method

Creates a stack from the elements in the source sequence.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static Stack<TSource> ToStack<TSource>(
    this IEnumerable<TSource> source
)

<ExtensionAttribute>
Public Shared Function ToStack(Of TSource) (
    source As IEnumerable(Of TSource)
) As Stack(Of TSource)
[<ExtensionAttribute>]
static member ToStack :
        source : IEnumerable<'TSource> -> Stack<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The sequence containing the elements to put in the stack.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: Stack TSource
A stack containing the same elements as the source sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.UnionBy(TSource, TKey) Method

XEnumerableUnionByTSource, TKey Method

Produces the set union of two sequences, based on the specified key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TSource> UnionBy<TSource, TKey>(
    this IEnumerable<TSource> source,
    IEnumerable<TSource> other,
    Func<TSource, TKey> keySelector,
    IEqualityComparer<TKey>? keyComparer = null
)

<ExtensionAttribute>
Public Shared Function UnionBy(Of TSource, TKey) (
    source As IEnumerable(Of TSource),
    other As IEnumerable(Of TSource),
    keySelector As Func(Of TSource, TKey),
    Optional keyComparer As IEqualityComparer(Of TKey) = Nothing
) As IEnumerable(Of TSource)
[<ExtensionAttribute>]
static member UnionBy :
        source : IEnumerable<'TSource> *
        other : IEnumerable<'TSource> *
        keySelector : Func<'TSource, 'TKey> *
        ?keyComparer : IEqualityComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The first sequence.
other
Type: System.Collections.GenericIEnumerable TSource
The second sequence.
keySelector
Type: SystemFunc TSource, TKey
A delegate that returns the key used to test for equality between elements.
keyComparer (Optional)
Type: System.Collections.GenericIEqualityComparer TKey
A comparer used to test for equality between keys.

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the key used to test for equality between elements.

Return Value

Type: IEnumerable TSource
The set union of source and other, based on the specified key and key comparer.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.Unit(TSource) Method

XEnumerableUnitTSource Method

Produces a sequence containing a single element.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TSource> Unit<TSource>(
    TSource item
)

Public Shared Function Unit(Of TSource) (
    item As TSource
) As IEnumerable(Of TSource)
static member Unit :
        item : 'TSource -> IEnumerable<'TSource>

Parameters

item
Type: TSource
The element to include in the sequence.

Type Parameters

TSource
The type of the element in the sequence.

Return Value

Type: IEnumerable TSource
A sequence containing the specified element.
Remarks
The output sequence is lazily evaluated.
See Also

Reference

XEnumerable Class


XEnumerable.WithIndex Method

XEnumerableWithIndex Method

Overload List
Name | Description
WithIndexTSource(IEnumerableTSource) | Associates an index to each element of the source sequence.
WithIndexTSource(ListTSource) | Associates an index to each element of the source ListT.
WithIndexTSource(TSource) | Associates an index to each element of the source array.
Top
See Also

Reference

XEnumerable Class


XEnumerable.WithIndex(TSource) Method (IEnumerable(TSource))

XEnumerableWithIndexTSource Method (IEnumerableTSource)

Associates an index to each element of the source sequence.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static XEnumerableWithIndexEnumerable<TSource> WithIndex<TSource>(
    this IEnumerable<TSource> source
)

<ExtensionAttribute>
Public Shared Function WithIndex(Of TSource) (
    source As IEnumerable(Of TSource)
) As XEnumerableWithIndexEnumerable(Of TSource)
[<ExtensionAttribute>]
static member WithIndex :
        source : IEnumerable<'TSource> -> XEnumerableWithIndexEnumerable<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable TSource
The source sequence.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: XEnumerableWithIndexEnumerable TSource
A sequence of elements paired with their index in the sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
WithIndex Overload


XEnumerable.WithIndex(TSource) Method (List(TSource))

XEnumerableWithIndexTSource Method (ListTSource)

Associates an index to each element of the source ListT.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static XEnumerableWithIndexListEnumerable<TSource> WithIndex<TSource>(
    this List<TSource> source
)

<ExtensionAttribute>
Public Shared Function WithIndex(Of TSource) (
    source As List(Of TSource)
) As XEnumerableWithIndexListEnumerable(Of TSource)
[<ExtensionAttribute>]
static member WithIndex :
        source : List<'TSource> -> XEnumerableWithIndexListEnumerable<'TSource>

Parameters

source
Type: System.Collections.GenericList TSource
The source list.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: XEnumerableWithIndexListEnumerable TSource
A sequence of elements paired with their index in the list.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type List TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
WithIndex Overload


XEnumerable.WithIndex(TSource) Method (TSource[])

XEnumerableWithIndexTSource Method (TSource)

Associates an index to each element of the source array.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static XEnumerableWithIndexArrayEnumerable<TSource> WithIndex<TSource>(
    this TSource[] source
)

<ExtensionAttribute>
Public Shared Function WithIndex(Of TSource) (
    source As TSource()
) As XEnumerableWithIndexArrayEnumerable(Of TSource)
[<ExtensionAttribute>]
static member WithIndex :
        source : 'TSource[] -> XEnumerableWithIndexArrayEnumerable<'TSource>

Parameters

source
Type: TSource
The source array.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: XEnumerableWithIndexArrayEnumerable TSource
A sequence of elements paired with their index in the array.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type . When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class
WithIndex Overload


XEnumerable.WithoutIndex(TSource) Method

XEnumerableWithoutIndexTSource Method

Removes the indexes from a sequence of indexed elements, returning only the elements themselves.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEnumerable<TSource> WithoutIndex<TSource>(
    this IEnumerable<ItemWithIndex<TSource>> source
)

<ExtensionAttribute>
Public Shared Function WithoutIndex(Of TSource) (
    source As IEnumerable(Of ItemWithIndex(Of TSource))
) As IEnumerable(Of TSource)
[<ExtensionAttribute>]
static member WithoutIndex :
        source : IEnumerable<ItemWithIndex<'TSource>> -> IEnumerable<'TSource>

Parameters

source
Type: System.Collections.GenericIEnumerable ItemWithIndex TSource
The sequence to remove the indexes from.

Type Parameters

TSource
The type of the indexed elements.

Return Value

Type: IEnumerable TSource
A sequence of elements without their associated indexes.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable ItemWithIndex TSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XEnumerable Class


XEnumerable.WithIndexArrayEnumerable(TSource) Structure

XEnumerableWithIndexArrayEnumerableTSource Structure

A sequence of elements associated with their index, optimized for the case when the underlying collection is an array.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public struct WithIndexArrayEnumerable<TSource> : IEnumerable<ItemWithIndex<TSource>>,
    IEnumerable

Public Structure WithIndexArrayEnumerable(Of TSource)
    Implements IEnumerable(Of ItemWithIndex(Of TSource)),
    IEnumerable
[<SealedAttribute>]
type WithIndexArrayEnumerable<'TSource> =
    struct
        interface IEnumerable<ItemWithIndex<'TSource>>
        interface IEnumerable
    end

Type Parameters

TSource
The type of the elements of the source array.

The XEnumerableWithIndexArrayEnumerableTSource type exposes the following members.

Methods
 | Name | Description
Public method | Equals | (Inherited from ValueType.)
Public method | GetEnumerator | Returns an enumerator that iterates through the XEnumerableWithIndexArrayEnumerableTSource.
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | ToString | (Inherited from ValueType.)
Top
Extension Methods
 | Name | Description
Public Extension Method | BatchItemWithIndexTSource | Splits the input sequence into a sequence of batches of the specified size. (Defined by XEnumerable.)
Public Extension Method | CommonPrefixItemWithIndexTSource | Returns the common prefix of two sequences, according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | DenseRankByItemWithIndexTSource, TKey, TResult | Associates an ascending dense rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DenseRankByDescendingItemWithIndexTSource, TKey, TResult | Associates a descending dense rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctByItemWithIndexTSource, TKey | Returns a sequence with distinct elements from the input sequence based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctUntilChangedItemWithIndexTSource | Returns a sequence with distinct adjacent elements from the input sequence based on the specified comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctUntilChangedByItemWithIndexTSource, TKey | Returns a sequence with distinct adjacent elements from the input sequence based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | ElementAtOrDefaultItemWithIndexTSource | Returns the element at a specified index in a sequence, or the specified default value if the index is out of range. (Defined by XEnumerable.)
Public Extension Method | ExceptByItemWithIndexTSource, TKey | Produces the set difference of two sequences by using the specified key and key comparer to test for equality between elements. (Defined by XEnumerable.)
Public Extension Method | FirstOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the first element of a sequence or the specified default value if the sequence contains no elements. (Defined by XEnumerable.)
Public Extension Method | FirstOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the first element of the sequence that satisfies a condition or the specied default value if no such element is found. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource, TResult(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode, FuncItemWithIndexTSource, Int32, TResult) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource, TResult(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode, FuncItemWithIndexTSource, TResult) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FullOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the full outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | GroupUntilChangedItemWithIndexTSource | Groups equal adjacent elements from the input sequence based on the specified comparer. (Defined by XEnumerable.)
Public Extension Method | GroupUntilChangedByItemWithIndexTSource, TKey | Groups adjacent elements from the input sequence that have the same value for the specified key, according to the specified key comparer. (Defined by XEnumerable.)
Public Extension Method | IndexOfItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Returns the position of the first element of source that verifies the specified predicate, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IndexOfItemWithIndexTSource(ItemWithIndexTSource, IEqualityComparerItemWithIndexTSource) | Overloaded. Returns the position of the first occurrence of item in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IndexOfSubstringItemWithIndexTSource | Returns the position of the first occurrence of the specified substring in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IntersectByItemWithIndexTSource, TKey | Produces the set intersection of two sequences, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | IsNullOrEmpty | Overloaded. Indicates whether a sequence is null or empty. (Defined by XEnumerable.)
Public Extension Method | IsNullOrEmptyItemWithIndexTSource | Overloaded. Indicates whether a sequence is null or empty. (Defined by XEnumerable.)
Public Extension Method | LastIndexOfItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Returns the position of the last element of source that verifies the specified predicate, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | LastIndexOfItemWithIndexTSource(ItemWithIndexTSource, IEqualityComparerItemWithIndexTSource) | Overloaded. Returns the position of the last occurrence of item in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | LastOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the last element of a sequence or the specified default value if the sequence contains no elements. (Defined by XEnumerable.)
Public Extension Method | LastOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the last element of the sequence that satisfies a condition or the specied default value if no such element is found. (Defined by XEnumerable.)
Public Extension Method | LeftOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the left outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | MaxItemWithIndexTSource | Returns the maximum element of the sequence according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | MaxByItemWithIndexTSource, TKey | Returns the element of the sequence that has the maximum value for the specified key. (Defined by XEnumerable.)
Public Extension Method | MinItemWithIndexTSource | Returns the minimum element of the sequence according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | MinByItemWithIndexTSource, TKey | Returns the element of the sequence that has the minimum value for the specified key. (Defined by XEnumerable.)
Public Extension Method | NoneItemWithIndexTSource | Overloaded. Checks if the sequence is empty. (Defined by XEnumerable.)
Public Extension Method | NoneItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Checks if the sequence contains no element that matches the predicate. (Defined by XEnumerable.)
Public Extension Method | RankByItemWithIndexTSource, TKey, TResult | Associates an ascending rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | RankByDescendingItemWithIndexTSource, TKey, TResult | Associates a descending rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | RightOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the right outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | SequenceEqualByItemWithIndexTSource, TKey | Determines whether two sequences are equal by comparing their elements using the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | SingleOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the only element of a sequence, or the specified default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. (Defined by XEnumerable.)
Public Extension Method | SingleOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the only element of a sequence that satisfies a specified condition, or the specified default value if no such element exists; this method throws an exception if more than one element satisfies the condition. (Defined by XEnumerable.)
Public Extension Method | ToArrayItemWithIndexTSource | Creates an array from the elements in the source sequence. Unlike ToArrayTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate an array of the right size from the start, hence suppressing the need for subsequent allocations and improving performance. (Defined by XEnumerable.)
Public Extension Method | ToHierarchyItemWithIndexTSource, TId | Builds a hierarchy from a flat sequence of elements, based on an Id/ParentId relation. (Defined by XEnumerable.)
Public Extension Method | ToLinkedListItemWithIndexTSource | Creates a linked list from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | ToListItemWithIndexTSource | Creates a ListT from the elements in the source sequence. Unlike ToListTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate a list with sufficient capacity, hence suppressing the need for subsequent allocations, and improving performance. (Defined by XEnumerable.)
Public Extension Method | ToQueueItemWithIndexTSource | Creates a queue from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | ToStackItemWithIndexTSource | Creates a stack from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | UnionByItemWithIndexTSource, TKey | Produces the set union of two sequences, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | WithIndexItemWithIndexTSource | Associates an index to each element of the source sequence. (Defined by XEnumerable.)
Top
See Also

Reference

Linq.Extras Namespace


WithIndexArrayEnumerable(TSource) Methods

WithIndexArrayEnumerableTSource Methods

The XEnumerableWithIndexArrayEnumerableTSource generic type exposes the following members.

Methods
 | Name | Description
Public method | Equals | (Inherited from ValueType.)
Public method | GetEnumerator | Returns an enumerator that iterates through the XEnumerableWithIndexArrayEnumerableTSource.
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | ToString | (Inherited from ValueType.)
Top
Extension Methods
 | Name | Description
Public Extension Method | BatchItemWithIndexTSource | Splits the input sequence into a sequence of batches of the specified size. (Defined by XEnumerable.)
Public Extension Method | CommonPrefixItemWithIndexTSource | Returns the common prefix of two sequences, according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | DenseRankByItemWithIndexTSource, TKey, TResult | Associates an ascending dense rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DenseRankByDescendingItemWithIndexTSource, TKey, TResult | Associates a descending dense rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctByItemWithIndexTSource, TKey | Returns a sequence with distinct elements from the input sequence based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctUntilChangedItemWithIndexTSource | Returns a sequence with distinct adjacent elements from the input sequence based on the specified comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctUntilChangedByItemWithIndexTSource, TKey | Returns a sequence with distinct adjacent elements from the input sequence based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | ElementAtOrDefaultItemWithIndexTSource | Returns the element at a specified index in a sequence, or the specified default value if the index is out of range. (Defined by XEnumerable.)
Public Extension Method | ExceptByItemWithIndexTSource, TKey | Produces the set difference of two sequences by using the specified key and key comparer to test for equality between elements. (Defined by XEnumerable.)
Public Extension Method | FirstOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the first element of a sequence or the specified default value if the sequence contains no elements. (Defined by XEnumerable.)
Public Extension Method | FirstOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the first element of the sequence that satisfies a condition or the specied default value if no such element is found. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource, TResult(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode, FuncItemWithIndexTSource, Int32, TResult) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource, TResult(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode, FuncItemWithIndexTSource, TResult) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FullOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the full outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | GroupUntilChangedItemWithIndexTSource | Groups equal adjacent elements from the input sequence based on the specified comparer. (Defined by XEnumerable.)
Public Extension Method | GroupUntilChangedByItemWithIndexTSource, TKey | Groups adjacent elements from the input sequence that have the same value for the specified key, according to the specified key comparer. (Defined by XEnumerable.)
Public Extension Method | IndexOfItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Returns the position of the first element of source that verifies the specified predicate, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IndexOfItemWithIndexTSource(ItemWithIndexTSource, IEqualityComparerItemWithIndexTSource) | Overloaded. Returns the position of the first occurrence of item in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IndexOfSubstringItemWithIndexTSource | Returns the position of the first occurrence of the specified substring in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IntersectByItemWithIndexTSource, TKey | Produces the set intersection of two sequences, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | IsNullOrEmpty | Overloaded. Indicates whether a sequence is null or empty. (Defined by XEnumerable.)
Public Extension Method | IsNullOrEmptyItemWithIndexTSource | Overloaded. Indicates whether a sequence is null or empty. (Defined by XEnumerable.)
Public Extension Method | LastIndexOfItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Returns the position of the last element of source that verifies the specified predicate, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | LastIndexOfItemWithIndexTSource(ItemWithIndexTSource, IEqualityComparerItemWithIndexTSource) | Overloaded. Returns the position of the last occurrence of item in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | LastOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the last element of a sequence or the specified default value if the sequence contains no elements. (Defined by XEnumerable.)
Public Extension Method | LastOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the last element of the sequence that satisfies a condition or the specied default value if no such element is found. (Defined by XEnumerable.)
Public Extension Method | LeftOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the left outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | MaxItemWithIndexTSource | Returns the maximum element of the sequence according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | MaxByItemWithIndexTSource, TKey | Returns the element of the sequence that has the maximum value for the specified key. (Defined by XEnumerable.)
Public Extension Method | MinItemWithIndexTSource | Returns the minimum element of the sequence according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | MinByItemWithIndexTSource, TKey | Returns the element of the sequence that has the minimum value for the specified key. (Defined by XEnumerable.)
Public Extension Method | NoneItemWithIndexTSource | Overloaded. Checks if the sequence is empty. (Defined by XEnumerable.)
Public Extension Method | NoneItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Checks if the sequence contains no element that matches the predicate. (Defined by XEnumerable.)
Public Extension Method | RankByItemWithIndexTSource, TKey, TResult | Associates an ascending rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | RankByDescendingItemWithIndexTSource, TKey, TResult | Associates a descending rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | RightOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the right outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | SequenceEqualByItemWithIndexTSource, TKey | Determines whether two sequences are equal by comparing their elements using the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | SingleOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the only element of a sequence, or the specified default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. (Defined by XEnumerable.)
Public Extension Method | SingleOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the only element of a sequence that satisfies a specified condition, or the specified default value if no such element exists; this method throws an exception if more than one element satisfies the condition. (Defined by XEnumerable.)
Public Extension Method | ToArrayItemWithIndexTSource | Creates an array from the elements in the source sequence. Unlike ToArrayTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate an array of the right size from the start, hence suppressing the need for subsequent allocations and improving performance. (Defined by XEnumerable.)
Public Extension Method | ToHierarchyItemWithIndexTSource, TId | Builds a hierarchy from a flat sequence of elements, based on an Id/ParentId relation. (Defined by XEnumerable.)
Public Extension Method | ToLinkedListItemWithIndexTSource | Creates a linked list from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | ToListItemWithIndexTSource | Creates a ListT from the elements in the source sequence. Unlike ToListTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate a list with sufficient capacity, hence suppressing the need for subsequent allocations, and improving performance. (Defined by XEnumerable.)
Public Extension Method | ToQueueItemWithIndexTSource | Creates a queue from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | ToStackItemWithIndexTSource | Creates a stack from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | UnionByItemWithIndexTSource, TKey | Produces the set union of two sequences, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | WithIndexItemWithIndexTSource | Associates an index to each element of the source sequence. (Defined by XEnumerable.)
Top
See Also

Reference

XEnumerableWithIndexArrayEnumerableTSource Structure


XEnumerable.WithIndexArrayEnumerable(TSource).GetEnumerator Method

XEnumerableWithIndexArrayEnumerableTSourceGetEnumerator Method

Returns an enumerator that iterates through the XEnumerableWithIndexArrayEnumerableTSource.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public XEnumerableWithIndexArrayEnumerableTSourceEnumerator GetEnumerator()
Public Function GetEnumerator As XEnumerableWithIndexArrayEnumerableTSourceEnumerator
member GetEnumerator : unit -> XEnumerableWithIndexArrayEnumerableTSourceEnumerator

Return Value

Type: XEnumerableWithIndexArrayEnumerableTSourceEnumerator
An enumerator that iterates through the XEnumerableWithIndexArrayEnumerableTSource.
See Also

Reference

XEnumerableWithIndexArrayEnumerableTSource Structure


XEnumerable.WithIndexArrayEnumerable(TSource).Enumerator Structure

XEnumerableWithIndexArrayEnumerableTSourceEnumerator Structure

Enumerates the elements of a XEnumerableWithIndexArrayEnumerableTSource.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public struct Enumerator : IEnumerator<ItemWithIndex<TSource>>,
    IEnumerator, IDisposable
Public Structure Enumerator
    Implements IEnumerator(Of ItemWithIndex(Of TSource)),
    IEnumerator, IDisposable
[<SealedAttribute>]
type Enumerator =
    struct
        interface IEnumerator<ItemWithIndex<'TSource>>
        interface IEnumerator
        interface IDisposable
    end

The XEnumerableWithIndexArrayEnumerableTSourceEnumerator generic type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element at the current position of the enumerator.
Top
Methods
 | Name | Description
Public method | Dispose | Releases all resources used by the XEnumerableWithIndexArrayEnumerableTSourceEnumerator.
Public method | Equals | (Inherited from ValueType.)
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | MoveNext | Advances the enumerator to the next element of the XEnumerableWithIndexArrayEnumerableTSource.
Public method | ToString | (Inherited from ValueType.)
Top
See Also

Reference

Linq.Extras Namespace


Enumerator Properties

The XEnumerableWithIndexArrayEnumerableTSourceEnumerator type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element at the current position of the enumerator.
Top
See Also

Reference

XEnumerableWithIndexArrayEnumerableTSourceEnumerator Structure


XEnumerable.WithIndexArrayEnumerable(TSource).Enumerator.Current Property

XEnumerableWithIndexArrayEnumerableTSourceEnumeratorCurrent Property

Gets the element at the current position of the enumerator.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public ItemWithIndex<TSource> Current { get; }
Public ReadOnly Property Current As ItemWithIndex(Of TSource)
    Get
abstract Current : ItemWithIndex<'TSource> with get
override Current : ItemWithIndex<'TSource> with get

Property Value

Type: ItemWithIndex TSource

Implements

IEnumeratorTCurrent
See Also

Reference

XEnumerableWithIndexArrayEnumerableTSourceEnumerator Structure


Enumerator Methods

The XEnumerableWithIndexArrayEnumerableTSourceEnumerator type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Releases all resources used by the XEnumerableWithIndexArrayEnumerableTSourceEnumerator.
Public method | Equals | (Inherited from ValueType.)
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | MoveNext | Advances the enumerator to the next element of the XEnumerableWithIndexArrayEnumerableTSource.
Public method | ToString | (Inherited from ValueType.)
Top
See Also

Reference

XEnumerableWithIndexArrayEnumerableTSourceEnumerator Structure


XEnumerable.WithIndexArrayEnumerable(TSource).Enumerator.Dispose Method

XEnumerableWithIndexArrayEnumerableTSourceEnumeratorDispose Method

Releases all resources used by the XEnumerableWithIndexArrayEnumerableTSourceEnumerator.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public void Dispose()
Public Sub Dispose
abstract Dispose : unit -> unit
override Dispose : unit -> unit

Implements

IDisposableDispose
See Also

Reference

XEnumerableWithIndexArrayEnumerableTSourceEnumerator Structure


XEnumerable.WithIndexArrayEnumerable(TSource).Enumerator.MoveNext Method

XEnumerableWithIndexArrayEnumerableTSourceEnumeratorMoveNext Method

Advances the enumerator to the next element of the XEnumerableWithIndexArrayEnumerableTSource.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public bool MoveNext()
Public Function MoveNext As Boolean
abstract MoveNext : unit -> bool
override MoveNext : unit -> bool

Return Value

Type: Boolean
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

Implements

IEnumeratorMoveNext
See Also

Reference

XEnumerableWithIndexArrayEnumerableTSourceEnumerator Structure


XEnumerable.WithIndexEnumerable(TSource) Structure

XEnumerableWithIndexEnumerableTSource Structure

A sequence of elements associated with their index.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public struct WithIndexEnumerable<TSource> : IEnumerable<ItemWithIndex<TSource>>,
    IEnumerable

Public Structure WithIndexEnumerable(Of TSource)
    Implements IEnumerable(Of ItemWithIndex(Of TSource)),
    IEnumerable
[<SealedAttribute>]
type WithIndexEnumerable<'TSource> =
    struct
        interface IEnumerable<ItemWithIndex<'TSource>>
        interface IEnumerable
    end

Type Parameters

TSource
The type of the elements of the source sequence.

The XEnumerableWithIndexEnumerableTSource type exposes the following members.

Methods
 | Name | Description
Public method | Equals | (Inherited from ValueType.)
Public method | GetEnumerator | Returns an enumerator that iterates through the XEnumerableWithIndexEnumerableTSource.
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | ToString | (Inherited from ValueType.)
Top
Extension Methods
 | Name | Description
Public Extension Method | BatchItemWithIndexTSource | Splits the input sequence into a sequence of batches of the specified size. (Defined by XEnumerable.)
Public Extension Method | CommonPrefixItemWithIndexTSource | Returns the common prefix of two sequences, according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | DenseRankByItemWithIndexTSource, TKey, TResult | Associates an ascending dense rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DenseRankByDescendingItemWithIndexTSource, TKey, TResult | Associates a descending dense rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctByItemWithIndexTSource, TKey | Returns a sequence with distinct elements from the input sequence based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctUntilChangedItemWithIndexTSource | Returns a sequence with distinct adjacent elements from the input sequence based on the specified comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctUntilChangedByItemWithIndexTSource, TKey | Returns a sequence with distinct adjacent elements from the input sequence based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | ElementAtOrDefaultItemWithIndexTSource | Returns the element at a specified index in a sequence, or the specified default value if the index is out of range. (Defined by XEnumerable.)
Public Extension Method | ExceptByItemWithIndexTSource, TKey | Produces the set difference of two sequences by using the specified key and key comparer to test for equality between elements. (Defined by XEnumerable.)
Public Extension Method | FirstOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the first element of a sequence or the specified default value if the sequence contains no elements. (Defined by XEnumerable.)
Public Extension Method | FirstOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the first element of the sequence that satisfies a condition or the specied default value if no such element is found. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource, TResult(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode, FuncItemWithIndexTSource, Int32, TResult) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource, TResult(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode, FuncItemWithIndexTSource, TResult) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FullOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the full outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | GroupUntilChangedItemWithIndexTSource | Groups equal adjacent elements from the input sequence based on the specified comparer. (Defined by XEnumerable.)
Public Extension Method | GroupUntilChangedByItemWithIndexTSource, TKey | Groups adjacent elements from the input sequence that have the same value for the specified key, according to the specified key comparer. (Defined by XEnumerable.)
Public Extension Method | IndexOfItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Returns the position of the first element of source that verifies the specified predicate, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IndexOfItemWithIndexTSource(ItemWithIndexTSource, IEqualityComparerItemWithIndexTSource) | Overloaded. Returns the position of the first occurrence of item in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IndexOfSubstringItemWithIndexTSource | Returns the position of the first occurrence of the specified substring in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IntersectByItemWithIndexTSource, TKey | Produces the set intersection of two sequences, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | IsNullOrEmpty | Overloaded. Indicates whether a sequence is null or empty. (Defined by XEnumerable.)
Public Extension Method | IsNullOrEmptyItemWithIndexTSource | Overloaded. Indicates whether a sequence is null or empty. (Defined by XEnumerable.)
Public Extension Method | LastIndexOfItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Returns the position of the last element of source that verifies the specified predicate, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | LastIndexOfItemWithIndexTSource(ItemWithIndexTSource, IEqualityComparerItemWithIndexTSource) | Overloaded. Returns the position of the last occurrence of item in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | LastOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the last element of a sequence or the specified default value if the sequence contains no elements. (Defined by XEnumerable.)
Public Extension Method | LastOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the last element of the sequence that satisfies a condition or the specied default value if no such element is found. (Defined by XEnumerable.)
Public Extension Method | LeftOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the left outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | MaxItemWithIndexTSource | Returns the maximum element of the sequence according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | MaxByItemWithIndexTSource, TKey | Returns the element of the sequence that has the maximum value for the specified key. (Defined by XEnumerable.)
Public Extension Method | MinItemWithIndexTSource | Returns the minimum element of the sequence according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | MinByItemWithIndexTSource, TKey | Returns the element of the sequence that has the minimum value for the specified key. (Defined by XEnumerable.)
Public Extension Method | NoneItemWithIndexTSource | Overloaded. Checks if the sequence is empty. (Defined by XEnumerable.)
Public Extension Method | NoneItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Checks if the sequence contains no element that matches the predicate. (Defined by XEnumerable.)
Public Extension Method | RankByItemWithIndexTSource, TKey, TResult | Associates an ascending rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | RankByDescendingItemWithIndexTSource, TKey, TResult | Associates a descending rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | RightOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the right outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | SequenceEqualByItemWithIndexTSource, TKey | Determines whether two sequences are equal by comparing their elements using the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | SingleOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the only element of a sequence, or the specified default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. (Defined by XEnumerable.)
Public Extension Method | SingleOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the only element of a sequence that satisfies a specified condition, or the specified default value if no such element exists; this method throws an exception if more than one element satisfies the condition. (Defined by XEnumerable.)
Public Extension Method | ToArrayItemWithIndexTSource | Creates an array from the elements in the source sequence. Unlike ToArrayTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate an array of the right size from the start, hence suppressing the need for subsequent allocations and improving performance. (Defined by XEnumerable.)
Public Extension Method | ToHierarchyItemWithIndexTSource, TId | Builds a hierarchy from a flat sequence of elements, based on an Id/ParentId relation. (Defined by XEnumerable.)
Public Extension Method | ToLinkedListItemWithIndexTSource | Creates a linked list from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | ToListItemWithIndexTSource | Creates a ListT from the elements in the source sequence. Unlike ToListTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate a list with sufficient capacity, hence suppressing the need for subsequent allocations, and improving performance. (Defined by XEnumerable.)
Public Extension Method | ToQueueItemWithIndexTSource | Creates a queue from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | ToStackItemWithIndexTSource | Creates a stack from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | UnionByItemWithIndexTSource, TKey | Produces the set union of two sequences, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | WithIndexItemWithIndexTSource | Associates an index to each element of the source sequence. (Defined by XEnumerable.)
Top
See Also

Reference

Linq.Extras Namespace


WithIndexEnumerable(TSource) Methods

WithIndexEnumerableTSource Methods

The XEnumerableWithIndexEnumerableTSource generic type exposes the following members.

Methods
 | Name | Description
Public method | Equals | (Inherited from ValueType.)
Public method | GetEnumerator | Returns an enumerator that iterates through the XEnumerableWithIndexEnumerableTSource.
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | ToString | (Inherited from ValueType.)
Top
Extension Methods
 | Name | Description
Public Extension Method | BatchItemWithIndexTSource | Splits the input sequence into a sequence of batches of the specified size. (Defined by XEnumerable.)
Public Extension Method | CommonPrefixItemWithIndexTSource | Returns the common prefix of two sequences, according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | DenseRankByItemWithIndexTSource, TKey, TResult | Associates an ascending dense rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DenseRankByDescendingItemWithIndexTSource, TKey, TResult | Associates a descending dense rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctByItemWithIndexTSource, TKey | Returns a sequence with distinct elements from the input sequence based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctUntilChangedItemWithIndexTSource | Returns a sequence with distinct adjacent elements from the input sequence based on the specified comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctUntilChangedByItemWithIndexTSource, TKey | Returns a sequence with distinct adjacent elements from the input sequence based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | ElementAtOrDefaultItemWithIndexTSource | Returns the element at a specified index in a sequence, or the specified default value if the index is out of range. (Defined by XEnumerable.)
Public Extension Method | ExceptByItemWithIndexTSource, TKey | Produces the set difference of two sequences by using the specified key and key comparer to test for equality between elements. (Defined by XEnumerable.)
Public Extension Method | FirstOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the first element of a sequence or the specified default value if the sequence contains no elements. (Defined by XEnumerable.)
Public Extension Method | FirstOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the first element of the sequence that satisfies a condition or the specied default value if no such element is found. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource, TResult(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode, FuncItemWithIndexTSource, Int32, TResult) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource, TResult(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode, FuncItemWithIndexTSource, TResult) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FullOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the full outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | GroupUntilChangedItemWithIndexTSource | Groups equal adjacent elements from the input sequence based on the specified comparer. (Defined by XEnumerable.)
Public Extension Method | GroupUntilChangedByItemWithIndexTSource, TKey | Groups adjacent elements from the input sequence that have the same value for the specified key, according to the specified key comparer. (Defined by XEnumerable.)
Public Extension Method | IndexOfItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Returns the position of the first element of source that verifies the specified predicate, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IndexOfItemWithIndexTSource(ItemWithIndexTSource, IEqualityComparerItemWithIndexTSource) | Overloaded. Returns the position of the first occurrence of item in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IndexOfSubstringItemWithIndexTSource | Returns the position of the first occurrence of the specified substring in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IntersectByItemWithIndexTSource, TKey | Produces the set intersection of two sequences, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | IsNullOrEmpty | Overloaded. Indicates whether a sequence is null or empty. (Defined by XEnumerable.)
Public Extension Method | IsNullOrEmptyItemWithIndexTSource | Overloaded. Indicates whether a sequence is null or empty. (Defined by XEnumerable.)
Public Extension Method | LastIndexOfItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Returns the position of the last element of source that verifies the specified predicate, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | LastIndexOfItemWithIndexTSource(ItemWithIndexTSource, IEqualityComparerItemWithIndexTSource) | Overloaded. Returns the position of the last occurrence of item in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | LastOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the last element of a sequence or the specified default value if the sequence contains no elements. (Defined by XEnumerable.)
Public Extension Method | LastOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the last element of the sequence that satisfies a condition or the specied default value if no such element is found. (Defined by XEnumerable.)
Public Extension Method | LeftOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the left outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | MaxItemWithIndexTSource | Returns the maximum element of the sequence according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | MaxByItemWithIndexTSource, TKey | Returns the element of the sequence that has the maximum value for the specified key. (Defined by XEnumerable.)
Public Extension Method | MinItemWithIndexTSource | Returns the minimum element of the sequence according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | MinByItemWithIndexTSource, TKey | Returns the element of the sequence that has the minimum value for the specified key. (Defined by XEnumerable.)
Public Extension Method | NoneItemWithIndexTSource | Overloaded. Checks if the sequence is empty. (Defined by XEnumerable.)
Public Extension Method | NoneItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Checks if the sequence contains no element that matches the predicate. (Defined by XEnumerable.)
Public Extension Method | RankByItemWithIndexTSource, TKey, TResult | Associates an ascending rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | RankByDescendingItemWithIndexTSource, TKey, TResult | Associates a descending rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | RightOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the right outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | SequenceEqualByItemWithIndexTSource, TKey | Determines whether two sequences are equal by comparing their elements using the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | SingleOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the only element of a sequence, or the specified default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. (Defined by XEnumerable.)
Public Extension Method | SingleOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the only element of a sequence that satisfies a specified condition, or the specified default value if no such element exists; this method throws an exception if more than one element satisfies the condition. (Defined by XEnumerable.)
Public Extension Method | ToArrayItemWithIndexTSource | Creates an array from the elements in the source sequence. Unlike ToArrayTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate an array of the right size from the start, hence suppressing the need for subsequent allocations and improving performance. (Defined by XEnumerable.)
Public Extension Method | ToHierarchyItemWithIndexTSource, TId | Builds a hierarchy from a flat sequence of elements, based on an Id/ParentId relation. (Defined by XEnumerable.)
Public Extension Method | ToLinkedListItemWithIndexTSource | Creates a linked list from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | ToListItemWithIndexTSource | Creates a ListT from the elements in the source sequence. Unlike ToListTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate a list with sufficient capacity, hence suppressing the need for subsequent allocations, and improving performance. (Defined by XEnumerable.)
Public Extension Method | ToQueueItemWithIndexTSource | Creates a queue from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | ToStackItemWithIndexTSource | Creates a stack from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | UnionByItemWithIndexTSource, TKey | Produces the set union of two sequences, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | WithIndexItemWithIndexTSource | Associates an index to each element of the source sequence. (Defined by XEnumerable.)
Top
See Also

Reference

XEnumerableWithIndexEnumerableTSource Structure


XEnumerable.WithIndexEnumerable(TSource).GetEnumerator Method

XEnumerableWithIndexEnumerableTSourceGetEnumerator Method

Returns an enumerator that iterates through the XEnumerableWithIndexEnumerableTSource.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public XEnumerableWithIndexEnumerableTSourceEnumerator GetEnumerator()
Public Function GetEnumerator As XEnumerableWithIndexEnumerableTSourceEnumerator
member GetEnumerator : unit -> XEnumerableWithIndexEnumerableTSourceEnumerator

Return Value

Type: XEnumerableWithIndexEnumerableTSourceEnumerator
An enumerator that iterates through the XEnumerableWithIndexEnumerableTSource.
See Also

Reference

XEnumerableWithIndexEnumerableTSource Structure


XEnumerable.WithIndexEnumerable(TSource).Enumerator Structure

XEnumerableWithIndexEnumerableTSourceEnumerator Structure

Enumerates the elements of a XEnumerableWithIndexEnumerableTSource.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public struct Enumerator : IEnumerator<ItemWithIndex<TSource>>,
    IEnumerator, IDisposable
Public Structure Enumerator
    Implements IEnumerator(Of ItemWithIndex(Of TSource)),
    IEnumerator, IDisposable
[<SealedAttribute>]
type Enumerator =
    struct
        interface IEnumerator<ItemWithIndex<'TSource>>
        interface IEnumerator
        interface IDisposable
    end

The XEnumerableWithIndexEnumerableTSourceEnumerator generic type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element at the current position of the enumerator.
Top
Methods
 | Name | Description
Public method | Dispose | Releases all resources used by the XEnumerableWithIndexEnumerableTSourceEnumerator.
Public method | Equals | (Inherited from ValueType.)
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | MoveNext | Advances the enumerator to the next element of the XEnumerableWithIndexEnumerableTSource.
Public method | ToString | (Inherited from ValueType.)
Top
See Also

Reference

Linq.Extras Namespace


Enumerator Properties

The XEnumerableWithIndexEnumerableTSourceEnumerator type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element at the current position of the enumerator.
Top
See Also

Reference

XEnumerableWithIndexEnumerableTSourceEnumerator Structure


XEnumerable.WithIndexEnumerable(TSource).Enumerator.Current Property

XEnumerableWithIndexEnumerableTSourceEnumeratorCurrent Property

Gets the element at the current position of the enumerator.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public ItemWithIndex<TSource> Current { get; }
Public ReadOnly Property Current As ItemWithIndex(Of TSource)
    Get
abstract Current : ItemWithIndex<'TSource> with get
override Current : ItemWithIndex<'TSource> with get

Property Value

Type: ItemWithIndex TSource

Implements

IEnumeratorTCurrent
See Also

Reference

XEnumerableWithIndexEnumerableTSourceEnumerator Structure


Enumerator Methods

The XEnumerableWithIndexEnumerableTSourceEnumerator type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Releases all resources used by the XEnumerableWithIndexEnumerableTSourceEnumerator.
Public method | Equals | (Inherited from ValueType.)
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | MoveNext | Advances the enumerator to the next element of the XEnumerableWithIndexEnumerableTSource.
Public method | ToString | (Inherited from ValueType.)
Top
See Also

Reference

XEnumerableWithIndexEnumerableTSourceEnumerator Structure


XEnumerable.WithIndexEnumerable(TSource).Enumerator.Dispose Method

XEnumerableWithIndexEnumerableTSourceEnumeratorDispose Method

Releases all resources used by the XEnumerableWithIndexEnumerableTSourceEnumerator.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public void Dispose()
Public Sub Dispose
abstract Dispose : unit -> unit
override Dispose : unit -> unit

Implements

IDisposableDispose
See Also

Reference

XEnumerableWithIndexEnumerableTSourceEnumerator Structure


XEnumerable.WithIndexEnumerable(TSource).Enumerator.MoveNext Method

XEnumerableWithIndexEnumerableTSourceEnumeratorMoveNext Method

Advances the enumerator to the next element of the XEnumerableWithIndexEnumerableTSource.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public bool MoveNext()
Public Function MoveNext As Boolean
abstract MoveNext : unit -> bool
override MoveNext : unit -> bool

Return Value

Type: Boolean
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

Implements

IEnumeratorMoveNext
See Also

Reference

XEnumerableWithIndexEnumerableTSourceEnumerator Structure


XEnumerable.WithIndexListEnumerable(TSource) Structure

XEnumerableWithIndexListEnumerableTSource Structure

A sequence of elements associated with their index, optimized for the case when the underlying collection is a ListT.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public struct WithIndexListEnumerable<TSource> : IEnumerable<ItemWithIndex<TSource>>,
    IEnumerable

Public Structure WithIndexListEnumerable(Of TSource)
    Implements IEnumerable(Of ItemWithIndex(Of TSource)),
    IEnumerable
[<SealedAttribute>]
type WithIndexListEnumerable<'TSource> =
    struct
        interface IEnumerable<ItemWithIndex<'TSource>>
        interface IEnumerable
    end

Type Parameters

TSource
The type of the elements of the source list.

The XEnumerableWithIndexListEnumerableTSource type exposes the following members.

Methods
 | Name | Description
Public method | Equals | (Inherited from ValueType.)
Public method | GetEnumerator | Returns an enumerator that iterates through the XEnumerableWithIndexListEnumerableTSource.
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | ToString | (Inherited from ValueType.)
Top
Extension Methods
 | Name | Description
Public Extension Method | BatchItemWithIndexTSource | Splits the input sequence into a sequence of batches of the specified size. (Defined by XEnumerable.)
Public Extension Method | CommonPrefixItemWithIndexTSource | Returns the common prefix of two sequences, according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | DenseRankByItemWithIndexTSource, TKey, TResult | Associates an ascending dense rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DenseRankByDescendingItemWithIndexTSource, TKey, TResult | Associates a descending dense rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctByItemWithIndexTSource, TKey | Returns a sequence with distinct elements from the input sequence based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctUntilChangedItemWithIndexTSource | Returns a sequence with distinct adjacent elements from the input sequence based on the specified comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctUntilChangedByItemWithIndexTSource, TKey | Returns a sequence with distinct adjacent elements from the input sequence based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | ElementAtOrDefaultItemWithIndexTSource | Returns the element at a specified index in a sequence, or the specified default value if the index is out of range. (Defined by XEnumerable.)
Public Extension Method | ExceptByItemWithIndexTSource, TKey | Produces the set difference of two sequences by using the specified key and key comparer to test for equality between elements. (Defined by XEnumerable.)
Public Extension Method | FirstOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the first element of a sequence or the specified default value if the sequence contains no elements. (Defined by XEnumerable.)
Public Extension Method | FirstOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the first element of the sequence that satisfies a condition or the specied default value if no such element is found. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource, TResult(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode, FuncItemWithIndexTSource, Int32, TResult) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource, TResult(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode, FuncItemWithIndexTSource, TResult) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FullOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the full outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | GroupUntilChangedItemWithIndexTSource | Groups equal adjacent elements from the input sequence based on the specified comparer. (Defined by XEnumerable.)
Public Extension Method | GroupUntilChangedByItemWithIndexTSource, TKey | Groups adjacent elements from the input sequence that have the same value for the specified key, according to the specified key comparer. (Defined by XEnumerable.)
Public Extension Method | IndexOfItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Returns the position of the first element of source that verifies the specified predicate, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IndexOfItemWithIndexTSource(ItemWithIndexTSource, IEqualityComparerItemWithIndexTSource) | Overloaded. Returns the position of the first occurrence of item in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IndexOfSubstringItemWithIndexTSource | Returns the position of the first occurrence of the specified substring in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IntersectByItemWithIndexTSource, TKey | Produces the set intersection of two sequences, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | IsNullOrEmpty | Overloaded. Indicates whether a sequence is null or empty. (Defined by XEnumerable.)
Public Extension Method | IsNullOrEmptyItemWithIndexTSource | Overloaded. Indicates whether a sequence is null or empty. (Defined by XEnumerable.)
Public Extension Method | LastIndexOfItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Returns the position of the last element of source that verifies the specified predicate, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | LastIndexOfItemWithIndexTSource(ItemWithIndexTSource, IEqualityComparerItemWithIndexTSource) | Overloaded. Returns the position of the last occurrence of item in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | LastOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the last element of a sequence or the specified default value if the sequence contains no elements. (Defined by XEnumerable.)
Public Extension Method | LastOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the last element of the sequence that satisfies a condition or the specied default value if no such element is found. (Defined by XEnumerable.)
Public Extension Method | LeftOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the left outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | MaxItemWithIndexTSource | Returns the maximum element of the sequence according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | MaxByItemWithIndexTSource, TKey | Returns the element of the sequence that has the maximum value for the specified key. (Defined by XEnumerable.)
Public Extension Method | MinItemWithIndexTSource | Returns the minimum element of the sequence according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | MinByItemWithIndexTSource, TKey | Returns the element of the sequence that has the minimum value for the specified key. (Defined by XEnumerable.)
Public Extension Method | NoneItemWithIndexTSource | Overloaded. Checks if the sequence is empty. (Defined by XEnumerable.)
Public Extension Method | NoneItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Checks if the sequence contains no element that matches the predicate. (Defined by XEnumerable.)
Public Extension Method | RankByItemWithIndexTSource, TKey, TResult | Associates an ascending rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | RankByDescendingItemWithIndexTSource, TKey, TResult | Associates a descending rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | RightOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the right outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | SequenceEqualByItemWithIndexTSource, TKey | Determines whether two sequences are equal by comparing their elements using the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | SingleOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the only element of a sequence, or the specified default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. (Defined by XEnumerable.)
Public Extension Method | SingleOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the only element of a sequence that satisfies a specified condition, or the specified default value if no such element exists; this method throws an exception if more than one element satisfies the condition. (Defined by XEnumerable.)
Public Extension Method | ToArrayItemWithIndexTSource | Creates an array from the elements in the source sequence. Unlike ToArrayTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate an array of the right size from the start, hence suppressing the need for subsequent allocations and improving performance. (Defined by XEnumerable.)
Public Extension Method | ToHierarchyItemWithIndexTSource, TId | Builds a hierarchy from a flat sequence of elements, based on an Id/ParentId relation. (Defined by XEnumerable.)
Public Extension Method | ToLinkedListItemWithIndexTSource | Creates a linked list from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | ToListItemWithIndexTSource | Creates a ListT from the elements in the source sequence. Unlike ToListTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate a list with sufficient capacity, hence suppressing the need for subsequent allocations, and improving performance. (Defined by XEnumerable.)
Public Extension Method | ToQueueItemWithIndexTSource | Creates a queue from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | ToStackItemWithIndexTSource | Creates a stack from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | UnionByItemWithIndexTSource, TKey | Produces the set union of two sequences, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | WithIndexItemWithIndexTSource | Associates an index to each element of the source sequence. (Defined by XEnumerable.)
Top
See Also

Reference

Linq.Extras Namespace


WithIndexListEnumerable(TSource) Methods

WithIndexListEnumerableTSource Methods

The XEnumerableWithIndexListEnumerableTSource generic type exposes the following members.

Methods
 | Name | Description
Public method | Equals | (Inherited from ValueType.)
Public method | GetEnumerator | Returns an enumerator that iterates through the XEnumerableWithIndexListEnumerableTSource.
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | ToString | (Inherited from ValueType.)
Top
Extension Methods
 | Name | Description
Public Extension Method | BatchItemWithIndexTSource | Splits the input sequence into a sequence of batches of the specified size. (Defined by XEnumerable.)
Public Extension Method | CommonPrefixItemWithIndexTSource | Returns the common prefix of two sequences, according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | DenseRankByItemWithIndexTSource, TKey, TResult | Associates an ascending dense rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DenseRankByDescendingItemWithIndexTSource, TKey, TResult | Associates a descending dense rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctByItemWithIndexTSource, TKey | Returns a sequence with distinct elements from the input sequence based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctUntilChangedItemWithIndexTSource | Returns a sequence with distinct adjacent elements from the input sequence based on the specified comparer. (Defined by XEnumerable.)
Public Extension Method | DistinctUntilChangedByItemWithIndexTSource, TKey | Returns a sequence with distinct adjacent elements from the input sequence based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | ElementAtOrDefaultItemWithIndexTSource | Returns the element at a specified index in a sequence, or the specified default value if the index is out of range. (Defined by XEnumerable.)
Public Extension Method | ExceptByItemWithIndexTSource, TKey | Produces the set difference of two sequences by using the specified key and key comparer to test for equality between elements. (Defined by XEnumerable.)
Public Extension Method | FirstOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the first element of a sequence or the specified default value if the sequence contains no elements. (Defined by XEnumerable.)
Public Extension Method | FirstOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the first element of the sequence that satisfies a condition or the specied default value if no such element is found. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource, TResult(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode, FuncItemWithIndexTSource, Int32, TResult) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FlattenItemWithIndexTSource, TResult(FuncItemWithIndexTSource, IEnumerableItemWithIndexTSource, TreeTraversalMode, FuncItemWithIndexTSource, TResult) | Overloaded. Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order. (Defined by XEnumerable.)
Public Extension Method | FullOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the full outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | GroupUntilChangedItemWithIndexTSource | Groups equal adjacent elements from the input sequence based on the specified comparer. (Defined by XEnumerable.)
Public Extension Method | GroupUntilChangedByItemWithIndexTSource, TKey | Groups adjacent elements from the input sequence that have the same value for the specified key, according to the specified key comparer. (Defined by XEnumerable.)
Public Extension Method | IndexOfItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Returns the position of the first element of source that verifies the specified predicate, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IndexOfItemWithIndexTSource(ItemWithIndexTSource, IEqualityComparerItemWithIndexTSource) | Overloaded. Returns the position of the first occurrence of item in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IndexOfSubstringItemWithIndexTSource | Returns the position of the first occurrence of the specified substring in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | IntersectByItemWithIndexTSource, TKey | Produces the set intersection of two sequences, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | IsNullOrEmpty | Overloaded. Indicates whether a sequence is null or empty. (Defined by XEnumerable.)
Public Extension Method | IsNullOrEmptyItemWithIndexTSource | Overloaded. Indicates whether a sequence is null or empty. (Defined by XEnumerable.)
Public Extension Method | LastIndexOfItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Returns the position of the last element of source that verifies the specified predicate, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | LastIndexOfItemWithIndexTSource(ItemWithIndexTSource, IEqualityComparerItemWithIndexTSource) | Overloaded. Returns the position of the last occurrence of item in the source sequence, or -1 if it is not found. (Defined by XEnumerable.)
Public Extension Method | LastOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the last element of a sequence or the specified default value if the sequence contains no elements. (Defined by XEnumerable.)
Public Extension Method | LastOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the last element of the sequence that satisfies a condition or the specied default value if no such element is found. (Defined by XEnumerable.)
Public Extension Method | LeftOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the left outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | MaxItemWithIndexTSource | Returns the maximum element of the sequence according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | MaxByItemWithIndexTSource, TKey | Returns the element of the sequence that has the maximum value for the specified key. (Defined by XEnumerable.)
Public Extension Method | MinItemWithIndexTSource | Returns the minimum element of the sequence according to the specified comparer. (Defined by XEnumerable.)
Public Extension Method | MinByItemWithIndexTSource, TKey | Returns the element of the sequence that has the minimum value for the specified key. (Defined by XEnumerable.)
Public Extension Method | NoneItemWithIndexTSource | Overloaded. Checks if the sequence is empty. (Defined by XEnumerable.)
Public Extension Method | NoneItemWithIndexTSource(FuncItemWithIndexTSource, Boolean) | Overloaded. Checks if the sequence contains no element that matches the predicate. (Defined by XEnumerable.)
Public Extension Method | RankByItemWithIndexTSource, TKey, TResult | Associates an ascending rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | RankByDescendingItemWithIndexTSource, TKey, TResult | Associates a descending rank to each element of the input sequence, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | RightOuterJoinItemWithIndexTSource, TRight, TKey, TResult | Produces the right outer join of two sequences. (Defined by XEnumerable.)
Public Extension Method | SequenceEqualByItemWithIndexTSource, TKey | Determines whether two sequences are equal by comparing their elements using the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | SingleOrDefaultItemWithIndexTSource(ItemWithIndexTSource) | Overloaded. Returns the only element of a sequence, or the specified default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. (Defined by XEnumerable.)
Public Extension Method | SingleOrDefaultItemWithIndexTSource(FuncItemWithIndexTSource, Boolean, ItemWithIndexTSource) | Overloaded. Returns the only element of a sequence that satisfies a specified condition, or the specified default value if no such element exists; this method throws an exception if more than one element satisfies the condition. (Defined by XEnumerable.)
Public Extension Method | ToArrayItemWithIndexTSource | Creates an array from the elements in the source sequence. Unlike ToArrayTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate an array of the right size from the start, hence suppressing the need for subsequent allocations and improving performance. (Defined by XEnumerable.)
Public Extension Method | ToHierarchyItemWithIndexTSource, TId | Builds a hierarchy from a flat sequence of elements, based on an Id/ParentId relation. (Defined by XEnumerable.)
Public Extension Method | ToLinkedListItemWithIndexTSource | Creates a linked list from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | ToListItemWithIndexTSource | Creates a ListT from the elements in the source sequence. Unlike ToListTSource(IEnumerableTSource), this method takes the number of elements as a parameter, so that it can allocate a list with sufficient capacity, hence suppressing the need for subsequent allocations, and improving performance. (Defined by XEnumerable.)
Public Extension Method | ToQueueItemWithIndexTSource | Creates a queue from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | ToStackItemWithIndexTSource | Creates a stack from the elements in the source sequence. (Defined by XEnumerable.)
Public Extension Method | UnionByItemWithIndexTSource, TKey | Produces the set union of two sequences, based on the specified key and key comparer. (Defined by XEnumerable.)
Public Extension Method | WithIndexItemWithIndexTSource | Associates an index to each element of the source sequence. (Defined by XEnumerable.)
Top
See Also

Reference

XEnumerableWithIndexListEnumerableTSource Structure


XEnumerable.WithIndexListEnumerable(TSource).GetEnumerator Method

XEnumerableWithIndexListEnumerableTSourceGetEnumerator Method

Returns an enumerator that iterates through the XEnumerableWithIndexListEnumerableTSource.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public XEnumerableWithIndexListEnumerableTSourceEnumerator GetEnumerator()
Public Function GetEnumerator As XEnumerableWithIndexListEnumerableTSourceEnumerator
member GetEnumerator : unit -> XEnumerableWithIndexListEnumerableTSourceEnumerator

Return Value

Type: XEnumerableWithIndexListEnumerableTSourceEnumerator
An enumerator that iterates through the XEnumerableWithIndexListEnumerableTSource.
See Also

Reference

XEnumerableWithIndexListEnumerableTSource Structure


XEnumerable.WithIndexListEnumerable(TSource).Enumerator Structure

XEnumerableWithIndexListEnumerableTSourceEnumerator Structure

Enumerates the elements of a XEnumerableWithIndexListEnumerableTSource.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public struct Enumerator : IEnumerator<ItemWithIndex<TSource>>,
    IEnumerator, IDisposable
Public Structure Enumerator
    Implements IEnumerator(Of ItemWithIndex(Of TSource)),
    IEnumerator, IDisposable
[<SealedAttribute>]
type Enumerator =
    struct
        interface IEnumerator<ItemWithIndex<'TSource>>
        interface IEnumerator
        interface IDisposable
    end

The XEnumerableWithIndexListEnumerableTSourceEnumerator generic type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element at the current position of the enumerator.
Top
Methods
 | Name | Description
Public method | Dispose | Releases all resources used by the XEnumerableWithIndexListEnumerableTSourceEnumerator.
Public method | Equals | (Inherited from ValueType.)
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | MoveNext | Advances the enumerator to the next element of the XEnumerableWithIndexListEnumerableTSource.
Public method | ToString | (Inherited from ValueType.)
Top
See Also

Reference

Linq.Extras Namespace


Enumerator Properties

The XEnumerableWithIndexListEnumerableTSourceEnumerator type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element at the current position of the enumerator.
Top
See Also

Reference

XEnumerableWithIndexListEnumerableTSourceEnumerator Structure


XEnumerable.WithIndexListEnumerable(TSource).Enumerator.Current Property

XEnumerableWithIndexListEnumerableTSourceEnumeratorCurrent Property

Gets the element at the current position of the enumerator.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public ItemWithIndex<TSource> Current { get; }
Public ReadOnly Property Current As ItemWithIndex(Of TSource)
    Get
abstract Current : ItemWithIndex<'TSource> with get
override Current : ItemWithIndex<'TSource> with get

Property Value

Type: ItemWithIndex TSource

Implements

IEnumeratorTCurrent
See Also

Reference

XEnumerableWithIndexListEnumerableTSourceEnumerator Structure


Enumerator Methods

The XEnumerableWithIndexListEnumerableTSourceEnumerator type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Releases all resources used by the XEnumerableWithIndexListEnumerableTSourceEnumerator.
Public method | Equals | (Inherited from ValueType.)
Public method | GetHashCode | (Inherited from ValueType.)
Public method | GetType | (Inherited from Object.)
Public method | MoveNext | Advances the enumerator to the next element of the XEnumerableWithIndexListEnumerableTSource.
Public method | ToString | (Inherited from ValueType.)
Top
See Also

Reference

XEnumerableWithIndexListEnumerableTSourceEnumerator Structure


XEnumerable.WithIndexListEnumerable(TSource).Enumerator.Dispose Method

XEnumerableWithIndexListEnumerableTSourceEnumeratorDispose Method

Releases all resources used by the XEnumerableWithIndexListEnumerableTSourceEnumerator.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public void Dispose()
Public Sub Dispose
abstract Dispose : unit -> unit
override Dispose : unit -> unit

Implements

IDisposableDispose
See Also

Reference

XEnumerableWithIndexListEnumerableTSourceEnumerator Structure


XEnumerable.WithIndexListEnumerable(TSource).Enumerator.MoveNext Method

XEnumerableWithIndexListEnumerableTSourceEnumeratorMoveNext Method

Advances the enumerator to the next element of the XEnumerableWithIndexListEnumerableTSource.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public bool MoveNext()
Public Function MoveNext As Boolean
abstract MoveNext : unit -> bool
override MoveNext : unit -> bool

Return Value

Type: Boolean
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

Implements

IEnumeratorMoveNext
See Also

Reference

XEnumerableWithIndexListEnumerableTSourceEnumerator Structure


XEqualityComparer Class

Provides extension and helper methods to create and work with equality comparers.
Inheritance Hierarchy
SystemObject
Linq.ExtrasXEqualityComparer

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static class XEqualityComparer
Public NotInheritable Class XEqualityComparer
[<AbstractClassAttribute>]
[<SealedAttribute>]
type XEqualityComparer =  class end

The XEqualityComparer type exposes the following members.

Methods
Name | Description
ByT, TKey | Creates an equality comparer based on the specified comparison key and key comparer.
Top
See Also

Reference

Linq.Extras Namespace


XEqualityComparer Methods

The XEqualityComparer type exposes the following members.

Methods
Name | Description
ByT, TKey | Creates an equality comparer based on the specified comparison key and key comparer.
Top
See Also

Reference

XEqualityComparer Class


XEqualityComparer.By(T, TKey) Method

XEqualityComparerByT, TKey Method

Creates an equality comparer based on the specified comparison key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEqualityComparer<T> By<T, TKey>(
    Func<T, TKey> keySelector,
    IEqualityComparer<TKey>? keyComparer = null
)

Public Shared Function By(Of T, TKey) (
    keySelector As Func(Of T, TKey),
    Optional keyComparer As IEqualityComparer(Of TKey) = Nothing
) As IEqualityComparer(Of T)
static member By :
        keySelector : Func<'T, 'TKey> *
        ?keyComparer : IEqualityComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IEqualityComparer<'T>

Parameters

keySelector
Type: SystemFunc T, TKey
A function that returns the comparison key.
keyComparer (Optional)
Type: System.Collections.GenericIEqualityComparer TKey
An optional comparer used to test the keys for equality.

Type Parameters

T
The type of the objects to test for equality.
TKey
The type of the comparison key.

Return Value

Type: IEqualityComparer T
An equality comparer based on the specified comparison key and key comparer.
See Also

Reference

XEqualityComparer Class


XEqualityComparer(T) Class

XEqualityComparerT Class

Provides a helper method to create equality comparers by taking advantage of generic type inference
Inheritance Hierarchy
SystemObject
Linq.ExtrasXEqualityComparerT

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static class XEqualityComparer<T>

Public NotInheritable Class XEqualityComparer(Of T)
[<AbstractClassAttribute>]
[<SealedAttribute>]
type XEqualityComparer<'T> =  class end

Type Parameters

T
The type of the objects to compare.

The XEqualityComparerT type exposes the following members.

Methods
Name | Description
ByTKey | Creates an equality comparer based on the specified comparison key and key comparer.
Top
See Also

Reference

Linq.Extras Namespace


XEqualityComparer(T) Methods

XEqualityComparerT Methods

The XEqualityComparerT generic type exposes the following members.

Methods
Name | Description
ByTKey | Creates an equality comparer based on the specified comparison key and key comparer.
Top
See Also

Reference

XEqualityComparerT Class


XEqualityComparer(T).By(TKey) Method

XEqualityComparerTByTKey Method

Creates an equality comparer based on the specified comparison key and key comparer.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static IEqualityComparer<T> By<TKey>(
    Func<T, TKey> keySelector,
    IEqualityComparer<TKey>? keyComparer = null
)

Public Shared Function By(Of TKey) (
    keySelector As Func(Of T, TKey),
    Optional keyComparer As IEqualityComparer(Of TKey) = Nothing
) As IEqualityComparer(Of T)
static member By :
        keySelector : Func<'T, 'TKey> *
        ?keyComparer : IEqualityComparer<'TKey>
(* Defaults:
        let _keyComparer = defaultArg keyComparer null
*)
-> IEqualityComparer<'T>

Parameters

keySelector
Type: SystemFunc T, TKey
A function that returns the comparison key.
keyComparer (Optional)
Type: System.Collections.GenericIEqualityComparer TKey
An optional comparer used to test the keys for equality.

Type Parameters

TKey
The type of the comparison key.

Return Value

Type: IEqualityComparer T
An equality comparer based on the specified comparison key and key comparer.
See Also

Reference

XEqualityComparerT Class


XList Class

Provides extension methods for working with lists.
Inheritance Hierarchy
SystemObject
Linq.ExtrasXList

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static class XList
<ExtensionAttribute>
Public NotInheritable Class XList
[<AbstractClassAttribute>]
[<SealedAttribute>]
[<ExtensionAttribute>]
type XList =  class end

The XList type exposes the following members.

Methods
Name | Description
AsReadOnlyT | Returns a read-only wrapper for the list.
ShuffleT | Shuffles the elements of a list using the specified Random instance.
SwapT | Swaps the elements at the specified positions in the list.
Top
See Also

Reference

Linq.Extras Namespace


XList Methods

The XList type exposes the following members.

Methods
Name | Description
AsReadOnlyT | Returns a read-only wrapper for the list.
ShuffleT | Shuffles the elements of a list using the specified Random instance.
SwapT | Swaps the elements at the specified positions in the list.
Top
See Also

Reference

XList Class


XList.AsReadOnly(T) Method

XListAsReadOnlyT Method

Returns a read-only wrapper for the list.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static ReadOnlyCollection<T> AsReadOnly<T>(
    this IList<T> list
)

<ExtensionAttribute>
Public Shared Function AsReadOnly(Of T) (
    list As IList(Of T)
) As ReadOnlyCollection(Of T)
[<ExtensionAttribute>]
static member AsReadOnly :
        list : IList<'T> -> ReadOnlyCollection<'T>

Parameters

list
Type: System.Collections.GenericIList T
The list for which to return a read-only wrapper.

Type Parameters

T
The type of the elements in list.

Return Value

Type: ReadOnlyCollection T
A read-only wrapper for list.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IList T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XList Class


XList.Shuffle(T) Method

XListShuffleT Method

Shuffles the elements of a list using the specified Random instance.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static void Shuffle<T>(
    this IList<T> list,
    Random? random = null
)

<ExtensionAttribute>
Public Shared Sub Shuffle(Of T) (
    list As IList(Of T),
    Optional random As Random = Nothing
)
[<ExtensionAttribute>]
static member Shuffle :
        list : IList<'T> *
        ?random : Random
(* Defaults:
        let _random = defaultArg random null
*)
-> unit

Parameters

list
Type: System.Collections.GenericIList T
The list to shuffle.
random (Optional)
Type: SystemRandom
A random number generator to use to shuffle the list. If null, a new random number generator will be used.

Type Parameters

T
The type of the elements in list.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IList T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XList Class


XList.Swap(T) Method

XListSwapT Method

Swaps the elements at the specified positions in the list.

Namespace: Linq.Extras
Assembly: Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
C#
VB
F#
Copy
public static void Swap<T>(
    this IList<T> list,
    int index1,
    int index2
)

<ExtensionAttribute>
Public Shared Sub Swap(Of T) (
    list As IList(Of T),
    index1 As Integer,
    index2 As Integer
)
[<ExtensionAttribute>]
static member Swap :
        list : IList<'T> *
        index1 : int *
        index2 : int -> unit

Parameters

list
Type: System.Collections.GenericIList T
The list in which to swap elements.
index1
Type: SystemInt32
The index of the first element to swap.
index2
Type: SystemInt32
The index of the second element to swap.

Type Parameters

T
The type of the elements in list.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IList T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

XList Class