Click or drag to resize
EnumerableExDoWhileTResult Method
Generates an enumerable sequence by repeating a source sequence as long as the given loop postcondition holds.

Namespace: System.Linq
Assembly: System.Interactive (in System.Interactive.dll) Version: 1.2.0.0
Syntax
C#
public static IEnumerable<TResult> DoWhile<TResult>(
	this IEnumerable<TResult> source,
	Func<bool> condition
)

Parameters

source
Type: System.Collections.GenericIEnumerableTResult
Source sequence to repeat while the condition evaluates true.
condition
Type: SystemFuncBoolean
Loop condition.

Type Parameters

TResult
Result sequence element type.

Return Value

Type: IEnumerableTResult
Sequence generated by repeating the given sequence until the condition evaluates to false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableTResult. 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