AsAsyncEnumerable.cs 1.4 KB

1234567891011121314151617181920212223242526
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT License.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Collections.Generic;
  5. namespace System.Linq
  6. {
  7. public static partial class AsyncEnumerableEx
  8. {
  9. // NB: Synchronous LINQ to Objects doesn't hide the implementation of the source either.
  10. // Note: this was previously in System.Linq.Async, but since .NET 10.0's System.Linq.AsyncEnumerable chose not to
  11. // implement it (even though Enumerable.AsEnumerable exists), we moved it into System.Interactive.Async so that
  12. // it remains available even after developers remove their dependency on the deprecated System.Linq.Async.
  13. /// <summary>
  14. /// Hides the identity of an async-enumerable sequence.
  15. /// </summary>
  16. /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
  17. /// <param name="source">An async-enumerable sequence whose identity to hide.</param>
  18. /// <returns>An async-enumerable sequence that hides the identity of the source sequence.</returns>
  19. /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
  20. public static IAsyncEnumerable<TSource> AsAsyncEnumerable<TSource>(this IAsyncEnumerable<TSource> source) => source;
  21. }
  22. }