Пример #1
0
        static Accessibility DetermineEffectiveAccessibility(ref ITypeDefinition typeScope, Accessibility memberAccessibility = Accessibility.Public)
        {
            Accessibility accessibility = memberAccessibility;

            while (typeScope.DeclaringTypeDefinition != null && !accessibility.LessThanOrEqual(Accessibility.Private))
            {
                accessibility = accessibility.Intersect(typeScope.Accessibility);
                typeScope     = typeScope.DeclaringTypeDefinition;
            }
            // Once we reach a private entity, we leave the loop with typeScope set to the class that
            // contains the private entity = the scope that needs to be searched.
            // Otherwise (if we don't find a private entity) we return the top-level class.
            return(accessibility);
        }