GetIfacesAll() 공개 메소드

public GetIfacesAll ( ) : TypeArray
리턴 TypeArray
예제 #1
0
        public static bool IsBaseAggregate(AggregateSymbol derived, AggregateSymbol @base)
        {
            Debug.Assert(!derived.IsEnum() && [email protected]());

            if (derived == @base)
            {
                return(true);      // identity.
            }
            // refactoring error tolerance:  structs and delegates can be base classes in error scenarios so
            // we cannot filter on whether or not the base is marked as sealed.

            if (@base.IsInterface())
            {
                // Search the direct and indirect interfaces via ifacesAll, going up the base chain...

                while (derived != null)
                {
                    foreach (AggregateType iface in derived.GetIfacesAll().Items)
                    {
                        if (iface.getAggregate() == @base)
                        {
                            return(true);
                        }
                    }
                    derived = derived.GetBaseAgg();
                }

                return(false);
            }

            // base is a class. Just go up the base class chain to look for it.

            while (derived.GetBaseClass() != null)
            {
                derived = derived.GetBaseClass().getAggregate();
                if (derived == @base)
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #2
0
        public bool IsBaseAggregate(AggregateSymbol derived, AggregateSymbol @base)
        {
            Debug.Assert(!derived.IsEnum() && [email protected]());

            if (derived == @base)
                return true;      // identity.

            // refactoring error tolerance:  structs and delegates can be base classes in error scenarios so
            // we cannot filter on whether or not the base is marked as sealed.

            if (@base.IsInterface())
            {
                // Search the direct and indirect interfaces via ifacesAll, going up the base chain...

                while (derived != null)
                {
                    for (int i = 0; i < derived.GetIfacesAll().Size; i++)
                    {
                        AggregateType iface = derived.GetIfacesAll().Item(i).AsAggregateType();
                        if (iface.getAggregate() == @base)
                            return true;
                    }
                    derived = derived.GetBaseAgg();
                }

                return false;
            }

            // base is a class. Just go up the base class chain to look for it.

            while (derived.GetBaseClass() != null)
            {
                derived = derived.GetBaseClass().getAggregate();
                if (derived == @base)
                    return true;
            }
            return false;
        }