IYielder.cs 969 B

12345678910111213141516171819202122232425262728
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Security;
  5. namespace System.Linq
  6. {
  7. /// <summary>
  8. /// Interface for yielding elements to enumerator.
  9. /// </summary>
  10. /// <typeparam name="T">Type of the elements yielded to an enumerator.</typeparam>
  11. public interface IYielder<in T>
  12. {
  13. /// <summary>
  14. /// Stops the enumeration.
  15. /// </summary>
  16. /// <returns>Awaitable object for use in an asynchronous method.</returns>
  17. IAwaitable Break();
  18. /// <summary>
  19. /// Yields a value to the enumerator.
  20. /// </summary>
  21. /// <param name="value">Value to yield return.</param>
  22. /// <returns>Awaitable object for use in an asynchronous method.</returns>
  23. IAwaitable Return(T value);
  24. }
  25. }