/// <summary>
        /// Converts an IEnumerable or IEnumerator to a DynValue
        /// </summary>
        /// <param name="script">The script.</param>
        /// <param name="obj">The object.</param>
        public static DynValue EnumerationToDynValue(Script script, object obj)
        {
            if (obj is IEnumerable ie)
            {
                return(EnumerableWrapper.ConvertIterator(script, ie.GetEnumerator()));
            }

            if (obj is IEnumerator ienum)
            {
                return(EnumerableWrapper.ConvertIterator(script, ienum));
            }

            return(null);
        }
Beispiel #2
0
        /// <summary>
        /// Converts an IEnumerable or IEnumerator to a DynValue
        /// </summary>
        /// <param name="script">The script.</param>
        /// <param name="obj">The object.</param>
        /// <returns></returns>
        public static DynValue EnumerationToDynValue(Script script, object obj)
        {
            if (obj is System.Collections.IEnumerable)
            {
                var enumer = (System.Collections.IEnumerable)obj;
                return(EnumerableWrapper.ConvertIterator(script, enumer.GetEnumerator()));
            }

            if (obj is System.Collections.IEnumerator)
            {
                var enumer = (System.Collections.IEnumerator)obj;
                return(EnumerableWrapper.ConvertIterator(script, enumer));
            }

            return(null);
        }