private bool AreAllEnclosingClassesPublic(IMemberDeclaration memberDeclaration) { IClassDeclaration enclosingTypeDeclaration = memberDeclaration.EnclosingClass; bool isEnclosingClassPublic = enclosingTypeDeclaration.IsPublic(); while (isEnclosingClassPublic && enclosingTypeDeclaration.EnclosingClass.Exists) { enclosingTypeDeclaration = enclosingTypeDeclaration.EnclosingClass; isEnclosingClassPublic = enclosingTypeDeclaration.IsPublic(); } return(isEnclosingClassPublic); }