Skip to content

M_CodeJam_Ranges_CompositeRangeExtensions_ToCompositeRangeFrom__3

Andrew Koryavchenko edited this page Jun 17, 2018 · 2 revisions

CompositeRangeExtensions.ToCompositeRangeFrom(TSource, T, TKey) Method (IEnumerable(TSource), Func(TSource, T), Func(TSource, TKey))

Converts sequence of elements to the composite range using only From boundary. The To boundary value is taken from the next item in sequence (+∞ for the last item in sequence)

Namespace: CodeJam.Ranges
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0

Syntax

C#

public static CompositeRange<T, TKey> ToCompositeRangeFrom<TSource, T, TKey>(
	this IEnumerable<TSource> source,
	Func<TSource, T> fromValueSelector,
	Func<TSource, TKey> keySelector
)

VB

<ExtensionAttribute>
Public Shared Function ToCompositeRangeFrom(Of TSource, T, TKey) ( 
	source As IEnumerable(Of TSource),
	fromValueSelector As Func(Of TSource, T),
	keySelector As Func(Of TSource, TKey)
) As CompositeRange(Of T, TKey)

F#

[<ExtensionAttribute>]
static member ToCompositeRangeFrom : 
        source : IEnumerable<'TSource> * 
        fromValueSelector : Func<'TSource, 'T> * 
        keySelector : Func<'TSource, 'TKey> -> CompositeRange<'T, 'TKey> 

Parameters

 

source
Type: System.Collections.Generic.IEnumerable(TSource)
Original collection.
fromValueSelector
Type: System.Func(TSource, T)
Callback to obtain a value for the From boundary.
keySelector
Type: System.Func(TSource, TKey)
Callback to obtain a value for the range key.

Type Parameters

 

TSource
The type of the values in original collection.
T
The type of the range values.
TKey
The type of the range key

Return Value

Type: CompositeRange(T, TKey)
A new composite range with keys filled from the original collection.

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

CompositeRangeExtensions Class
ToCompositeRangeFrom Overload
CodeJam.Ranges Namespace

Clone this wiki locally