Class IEnumerableExtensions
Extension methods for IEnumerable<T> types.
Inherited Members
Namespace: Microsoft.GNS.Roster.Extensions
Assembly: Microsoft.XboxStudios.SQTech.Roster.Common.dll
Syntax
public static class IEnumerableExtensionsMethods
View SourceIterateWhileAsync<T>(IEnumerable<T>, Func<T, Task<bool>>, CancellationToken)
Performs a function on each item in an enumeration using async tasks in a task pool safe manner.
Declaration
public static Task<bool> IterateWhileAsync<T>(this IEnumerable<T> source, Func<T, Task<bool>> func, CancellationToken cancellationToken = default)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerable<T> | source | The collection to iterate on. | 
| Func<T, Task<bool>> | func | The function to call for each item. Return true to continue execution. False to terminate further loops. | 
| CancellationToken | cancellationToken | An optional cancellation token source for early termination. | 
Returns
| Type | Description | 
|---|---|
| Task<bool> | True if iteration is intentionally terminated. Otherwise false. | 
Type Parameters
| Name | Description | 
|---|---|
| T | The type to enumerate. | 
SynchronousForEachAwaitAsync<T>(IEnumerable<T>, Func<T, Task>, CancellationToken)
Performs a function on each item in an enumeration using async tasks in a task pool safe manner.
Declaration
public static Task SynchronousForEachAwaitAsync<T>(this IEnumerable<T> source, Func<T, Task> func, CancellationToken cancellationToken = default)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerable<T> | source | The collection to iterate on. | 
| Func<T, Task> | func | The function to call for each item. | 
| CancellationToken | cancellationToken | An optional cancellation token source for early termination. | 
Returns
| Type | Description | 
|---|---|
| Task | A task representing the work iterating over the source collection. | 
Type Parameters
| Name | Description | 
|---|---|
| T | The type to enumerate. |