public static bool IsAsyncEnumerator(this Type type, out AsyncEnumeratorInfo enumeratorInfo)
        {
            if (type is null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            var isEnumerator = type.IsAsyncEnumeratorType(out var current, out var moveNextAsync, out var disposeAsync);

            enumeratorInfo = new AsyncEnumeratorInfo(current, moveNextAsync, disposeAsync);
            return(isEnumerator);
        }
示例#2
0
 public AsyncEnumerableInfo(MethodInfo getAsyncEnumerator, AsyncEnumeratorInfo enumeratorInfo)
 {
     GetAsyncEnumerator = getAsyncEnumerator;
     EnumeratorInfo     = enumeratorInfo;
 }
 public Enumerator(AsyncEnumerableWrapper <TEnumerable, TItem> enumerable, CancellationToken token)
 {
     info     = enumerable.Info.EnumeratorInfo;
     instance = enumerable.Info.InvokeGetAsyncEnumerator(enumerable.Instance, token);
 }