@is() публичный абстрактный Метод

public abstract @is ( Type type ) : bool
type Type
Результат bool
Пример #1
0
        /// <summary>
        /// Given a list of objects, compute the most specific type which they all
        /// share,or at worst return sys::Obj.  This method does not take into
        /// account interfaces, only extends class inheritance.
        /// </summary>
        public static Type common(object[] objs, int n)
        {
            if (objs.Length == 0)
            {
                return(Sys.ObjType.toNullable());
            }
            bool nullable = false;
            Type best     = null;

            for (int i = 0; i < n; ++i)
            {
                object obj = objs[i];
                if (obj == null)
                {
                    nullable = true; continue;
                }
                Type t = @typeof(obj);
                if (best == null)
                {
                    best = t; continue;
                }
                while (!t.@is(best))
                {
                    best = best.@base();
                    if (best == null)
                    {
                        return(nullable ? Sys.ObjType.toNullable() : Sys.ObjType);
                    }
                }
            }
            if (best == null)
            {
                best = Sys.ObjType;
            }
            return(nullable ? best.toNullable() : best);
        }