MoreEnumerableUnfoldTState, T, TResult Method
            Returns a sequence generated by applying a state to the generator function,
            and from its result, determines if the sequence should have a next element, its value,
            and the next state in the recursive call.
            
Namespace: MoreLinqAssembly: MoreLinq (in MoreLinq.dll) Version: 4.4.0+6d97c3b1d482f98300f4446df14742b0e3fafbec
public static IEnumerable<TResult> Unfold<TState, T, TResult>(
	TState state,
	Func<TState, T> generator,
	Func<T, bool> predicate,
	Func<T, TState> stateSelector,
	Func<T, TResult> resultSelector
)
Public Shared Function Unfold(Of TState, T, TResult) ( 
	state As TState,
	generator As Func(Of TState, T),
	predicate As Func(Of T, Boolean),
	stateSelector As Func(Of T, TState),
	resultSelector As Func(Of T, TResult)
) As IEnumerable(Of TResult)
public:
generic<typename TState, typename T, typename TResult>
static IEnumerable<TResult>^ Unfold(
	TState state, 
	Func<TState, T>^ generator, 
	Func<T, bool>^ predicate, 
	Func<T, TState>^ stateSelector, 
	Func<T, TResult>^ resultSelector
)
static member Unfold : 
        state : 'TState * 
        generator : Func<'TState, 'T> * 
        predicate : Func<'T, bool> * 
        stateSelector : Func<'T, 'TState> * 
        resultSelector : Func<'T, 'TResult> -> IEnumerable<'TResult> 
- state  TState
- The initial state.
- generator  FuncTState, T
- 
            Function that takes a state and computes the next state and the next element of the sequence.
            
- predicate  FuncT, Boolean
- 
            Function to determine if the unfolding should continue based the
            result of the generator function.
            
- stateSelector  FuncT, TState
- 
            Function to select the state from the output of the generator function.
            
- resultSelector  FuncT, TResult
- 
            Function to select the result from the output of the generator function.
            
- TState
- Type of state elements.
- T
- Type of the elements generated by the generator function.
- TResult
- The type of the elements of the result sequence.
IEnumerableTResultA sequence containing the results generated by the 
resultSelector function.
 
            This operator uses deferred execution and streams its results.