Ejemplo n.º 1
0
        /// <summary>
        /// Create <see cref="IEnumerable{T}"/> wrapper for <see cref="IEnumerator{T}"/>.
        /// </summary>
        /// <typeparam name="T">The type of objects to enumerate.</typeparam>
        /// <param name="enumerator">The enumerator to wrap.</param>
        /// <returns><see cref="EnumerableAdapter{T}"/>.</returns>
        public static EnumerableAdapter <T> AsEnumerable <T>(this IEnumerator <T> enumerator)
        {
            if (enumerator == null)
            {
                throw new ArgumentNullException(nameof(enumerator));
            }

            return(enumerator.AsEnumerableInternal());
        }