/// <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)); }
public CoroutineIterator(ProduceAsyncDelegate <T> produceAsync, string displayName) { if (produceAsync is null) { throw new ArgumentNullException(nameof(produceAsync)); } _produceAsync = produceAsync; _displayName = displayName ?? base.ToString(); }
private CoroutineIterator(CoroutineIterator <T> parent) { _produceAsync = parent._produceAsync; _displayName = parent._displayName; }