 | attachAttachT1, T2 Method (IEnumerableT1, FuncT1, T2) |
Turns each element in an
IEnumerableT 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 IEnumerable<Tuple<T1, T2>> Attach<T1, T2>(
this IEnumerable<T1> this,
Func<T1, T2> selector
)
Parameters
- this
- Type: System.Collections.GenericIEnumerableT1
The original IEnumerableT - 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 IEnumerableT
- T2
- The type of selector's output.
Return Value
Type:
IEnumerableTupleT1,
T2An
IEnumerableT 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
IEnumerableT1. 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.
See Also