IEnumerableExtensionsTakeUntilT Method
Returns elements from a sequence until a specified condition is true.
Namespace: DevCase.Extensions.IEnumerableExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static IEnumerable<T> TakeUntil<T>(
this IEnumerable<T> enumerable,
Func<T, bool> endCondition,
bool throwErrorIfConditionNotSatisfied = false
)
<ExtensionAttribute>
Public Shared Function TakeUntil(Of T) (
enumerable As IEnumerable(Of T),
endCondition As Func(Of T, Boolean),
Optional throwErrorIfConditionNotSatisfied As Boolean = false
) As IEnumerable(Of T)
Dim enumerable As IEnumerable(Of T)
Dim endCondition As Func(Of T, Boolean)
Dim throwErrorIfConditionNotSatisfied As Boolean
Dim returnValue As IEnumerable(Of T)
returnValue = enumerable.TakeUntil(endCondition,
throwErrorIfConditionNotSatisfied)
public:
[ExtensionAttribute]
generic<typename T>
static IEnumerable<T>^ TakeUntil(
IEnumerable<T>^ enumerable,
Func<T, bool>^ endCondition,
bool throwErrorIfConditionNotSatisfied = false
)
[<ExtensionAttribute>]
static member TakeUntil :
enumerable : IEnumerable<'T> *
endCondition : Func<'T, bool> *
?throwErrorIfConditionNotSatisfied : bool
(* Defaults:
let _throwErrorIfConditionNotSatisfied = defaultArg throwErrorIfConditionNotSatisfied false
*)
-> IEnumerable<'T>
No code example is currently available or this language may not be supported.
- enumerable IEnumerableT
-
The IEnumerableT to iterate.
- endCondition FuncT, Boolean
-
A function to test each element for a condition.
- throwErrorIfConditionNotSatisfied Boolean (Optional)
-
Optional. True to throw an InvalidOperationException if no element
satisfies the condition specified in the endCondition parameter.
Default value: false
- T
-
The type of the collection.
IEnumerableT
An
IEnumerableT that contains the elements from the source sequence that occur before
the element at which passes the test condition specified in
endCondition parameter.
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableT. 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).
This is a code example.
No code example is currently available or this language may not be supported.
Dim list As New List(Of Integer) From {1, 2, 3, 4, 5, 6, 7, 8, 9}
Dim enumerable As IEnumerable(Of Integer) = list.TakeUntil(Function(x) x = 5, throwErrorIfConditionNotSatisfied:=True)
For Each item As Integer In enumerable
Console.WriteLine(item)
Next
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.