Exemplo n.º 1
0
        /// <summary>
        /// Implements __contains__ for types implementing IEnumerable
        /// </summary>
        public static bool ContainsMethodIEnumerator(CodeContext /*!*/ context, IEnumerator enumerator, object value)
        {
            while (enumerator.MoveNext())
            {
                if (PythonOps.EqualRetBool(context, enumerator.Current, value))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Implements __contains__ for types implementing IEnumerable of T.
        /// </summary>
        public static bool ContainsGenericMethod <T>(CodeContext /*!*/ context, IEnumerable <T> enumerable, T value)
        {
            foreach (T item in enumerable)
            {
                if (PythonOps.EqualRetBool(context, item, value))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Implements __contains__ for types implementing IEnumerable
        /// </summary>
        public static bool ContainsMethod(CodeContext /*!*/ context, IEnumerable enumerable, object value)
        {
            IEnumerator ie = enumerable.GetEnumerator();

            while (ie.MoveNext())
            {
                if (PythonOps.EqualRetBool(context, ie.Current, value))
                {
                    return(true);
                }
            }

            return(false);
        }