コード例 #1
0
ファイル: Factory.cs プロジェクト: stazz/AsyncEnumeration
 /// <summary>
 /// This creates a <see cref="IAsyncEnumerable{T}"/> that will behave like the given set of delegates.
 /// Each enumeration is assumed to be stateless, meaning that the same set of delegates is shared by all instances returned by <see cref="IAsyncEnumerable{T}.GetAsyncEnumerator"/>.
 /// </summary>
 /// <typeparam name="T">The type of items being enumerated.</typeparam>
 /// <param name="startInfo">The <see cref="WrappingEnumerationStartInfo{T}"/> containing delegates that capture all signatures of all methods of <see cref="IAsyncEnumerator{T}"/> interface.</param>
 /// <returns>A new <see cref="IAsyncEnumerable{T}"/>, which will share the given delegates by all instances returned by <see cref="IAsyncEnumerable{T}.GetAsyncEnumerator"/>.</returns>
 /// <param name="asyncProvider">The <see cref="IAsyncProvider"/> for the returned <see cref="IAsyncEnumerable{T}"/>.</param>
 /// <exception cref="ArgumentNullException">If either of <see cref="WrappingEnumerationStartInfo{T}.WaitForNext"/> or <see cref="WrappingEnumerationStartInfo{T}.TryGetNext"/> delegates of <paramref name="startInfo"/> are <c>null</c>.</exception>
 /// <seealso cref="WrappingEnumerationStartInfo{T}"/>
 /// <seealso cref="CreateWrappingStartInfo"/>
 public static IAsyncEnumerable <T> CreateStatelessWrappingEnumerable <T>(
     WrappingEnumerationStartInfo <T> startInfo,
     IAsyncProvider asyncProvider
     )
 {
     return(new StatelessAsyncEnumerableWrapper <T>(startInfo, asyncProvider));
 }
コード例 #2
0
 public StatelessAsyncEnumerableWrapper(
     WrappingEnumerationStartInfo <T> startInfo,
     IAsyncProvider asyncProvider
     )
 {
     this._enumerator   = new AsyncEnumeratorWrapper <T>(startInfo);
     this.AsyncProvider = ArgumentValidator.ValidateNotNull(nameof(asyncProvider), asyncProvider);
 }
コード例 #3
0
 public AsyncEnumeratorWrapper(
     WrappingEnumerationStartInfo <T> startInfo
     )
 {
     AsyncEnumeratorWrapperInitializer.InitVars(startInfo.WaitForNext, startInfo.TryGetNext, startInfo.Dispose, out this._waitForNext, out this._tryGetNext, out this._dispose);
 }
コード例 #4
0
ファイル: Factory.cs プロジェクト: stazz/AsyncEnumeration
 /// <summary>
 /// This creates a <see cref="IAsyncEnumerator{T}"/> that will behave like the given set of delegates.
 /// </summary>
 /// <typeparam name="T">The type of items being enumerated.</typeparam>
 /// <param name="startInfo">The <see cref="WrappingEnumerationStartInfo{T}"/> containing delegates that capture all signatures of all methods of <see cref="IAsyncEnumerator{T}"/> interface.</param>
 /// <returns>A new <see cref="IAsyncEnumerator{T}"/>, which will behave like the given set of delegates.</returns>
 /// <exception cref="ArgumentNullException">If either of <see cref="WrappingEnumerationStartInfo{T}.WaitForNext"/> or <see cref="WrappingEnumerationStartInfo{T}.TryGetNext"/> delegates of <paramref name="startInfo"/> are <c>null</c>.</exception>
 /// <seealso cref="WrappingEnumerationStartInfo{T}"/>
 /// <seealso cref="CreateWrappingStartInfo"/>
 public static IAsyncEnumerator <T> CreateWrappingEnumerator <T>(
     WrappingEnumerationStartInfo <T> startInfo
     )
 {
     return(new AsyncEnumeratorWrapper <T>(startInfo));
 }