Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

47 rader
1.1 KiB

  1. using System.Threading;
  2. namespace Cysharp.Threading.Tasks.Linq
  3. {
  4. public static partial class UniTaskAsyncEnumerable
  5. {
  6. public static IUniTaskAsyncEnumerable<T> Empty<T>()
  7. {
  8. return Cysharp.Threading.Tasks.Linq.Empty<T>.Instance;
  9. }
  10. }
  11. internal class Empty<T> : IUniTaskAsyncEnumerable<T>
  12. {
  13. public static readonly IUniTaskAsyncEnumerable<T> Instance = new Empty<T>();
  14. Empty()
  15. {
  16. }
  17. public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)
  18. {
  19. return _Empty.Instance;
  20. }
  21. class _Empty : IUniTaskAsyncEnumerator<T>
  22. {
  23. public static readonly IUniTaskAsyncEnumerator<T> Instance = new _Empty();
  24. _Empty()
  25. {
  26. }
  27. public T Current => default;
  28. public UniTask<bool> MoveNextAsync()
  29. {
  30. return CompletedTasks.False;
  31. }
  32. public UniTask DisposeAsync()
  33. {
  34. return default;
  35. }
  36. }
  37. }
  38. }