AjTalk.Language.EnumerableBehavior.IncludesMethod C# (CSharp) Метод

IncludesMethod() приватный Метод

private IncludesMethod ( System.Machine machine, object obj, object arguments ) : object
machine System.Machine
obj object
arguments object
Результат object
        private object IncludesMethod(Machine machine, object obj, object[] arguments)
        {
            var list = obj as IList;
            var argument = arguments[0];

            if (list != null)
                return list.Contains(argument);

            foreach (var element in (IEnumerable)obj)
            {
                if (element == null && argument == null)
                    return true;
                if (element != null && element.Equals(argument))
                    return true;
            }

            return false;
        }