예제 #1
0
 /// <summary>
 /// Create a <see cref="IAsyncEnumerable{T}"/> defined by a <see cref="ProduceAsyncDelegate{T}"/> coroutine.
 /// </summary>
 public static IAsyncEnumerable <T> Create <T>(T _, ProduceAsyncDelegate <T> produceAsync, [CallerMemberName] string displayName = default)
 {
     if (produceAsync == null)
     {
         throw new ArgumentNullException(nameof(produceAsync));
     }
     return(new CoroutineIterator <T>(produceAsync, displayName));
 }
예제 #2
0
        public CoroutineIterator(ProduceAsyncDelegate <T> produceAsync, string displayName)
        {
            if (produceAsync is null)
            {
                throw new ArgumentNullException(nameof(produceAsync));
            }

            _produceAsync = produceAsync;
            _displayName  = displayName ?? base.ToString();
        }
예제 #3
0
 private CoroutineIterator(CoroutineIterator <T> parent)
 {
     _produceAsync = parent._produceAsync;
     _displayName  = parent._displayName;
 }