This project is read-only.

MemberHelper not honoring NameFormattingOptions.Visibility?

Topics: Metadata Model
May 22, 2010 at 8:36 PM

Hello.

Is it correct that MemberHelper doesn't honor NameFormattingOptions.Visibility and that in general there is no code to get a C#-like string describing the visibility of a member?

 

May 22, 2010 at 9:00 PM

    public static class VisibilityHelper {
        public static string MakeCSharpString(TypeMemberVisibility visibility) {
            switch (visibility) {
                case TypeMemberVisibility.Public:
                    return "public";
                case TypeMemberVisibility.Default:
                case TypeMemberVisibility.Private:
                    return "private";
                case TypeMemberVisibility.Other:
                    return "other";
                case TypeMemberVisibility.FamilyOrAssembly:
                    return "protected internal";
                case TypeMemberVisibility.FamilyAndAssembly:
                    throw new NotImplementedException();
                case TypeMemberVisibility.Family:
                    return "protected";
                case TypeMemberVisibility.Assembly:
                    return "internal";
                default:
                    throw new NotImplementedException();
            }
        }
    }

What should return for TypeMemberVisibility.Other and for TypeMemberVisibility.FamilyAndAssembly?

mmh... this is pretty dumb. probably I should stick to TypeMemberVisibility names.