 | attachAttachT1, T2 Method (IListT1, FuncT1, T2) |
Turns each element in an
IListT to a tuple including itself and an output of itself and a selector function.
Namespace:
WhetStone.Looping
Assembly:
WhetStone (in WhetStone.dll) Version: 1.0.4.0 (1.0.0.0)
Syntaxpublic static IList<Tuple<T1, T2>> Attach<T1, T2>(
this IList<T1> this,
Func<T1, T2> selector
)
Parameters
- this
- Type: System.Collections.GenericIListT1
The original IListT - selector
- Type: SystemFuncT1, T2
The function from which to get the output as the second member of the tuple.
Type Parameters
- T1
- The type of the original IListT
- T2
- The type of selector's output.
Return Value
Type:
IListTupleT1,
T2An
IListT of type
TupleT1, T2 of
this's elements with the output of the selector function applied to them.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IListT1. 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).
Remarksenumerable.Attach(selector) is functionally identical to
enumerable.Zip(enumerable.Select(selector)). Although here, the enumerable is enumerated only once per output enumeration, the
ItemInt32 is invoked once per access.
See Also