Show / Hide Table of Contents

Class IEnumerableExtensions

Extension methods for IEnumerable<T> types.

Inheritance
object
IEnumerableExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Microsoft.GNS.Roster.Extensions
Assembly: Microsoft.XboxStudios.SQTech.Roster.Common.dll
Syntax
public static class IEnumerableExtensions

Methods

View Source

IterateWhileAsync<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.

View Source

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.

  • View Source
In this article
Back to top Generated by DocFX