Example #1
0
        internal bool MemberShouldBeVisible(MemberInfo member)
        {
            if (ShowNonPublic)
            {
                return(true);
            }

            AccessModifiers effectiveAccess = NetMemberBrowserInfo.GetMemberAccess(member);

            switch (effectiveAccess)
            {
            case AccessModifiers.Public:
            case AccessModifiers.Protected:
            case AccessModifiers.ProtectedInternal:
                return(true);

            case AccessModifiers.Internal:
            case AccessModifiers.Private:
            case AccessModifiers.Unknown:
                return(false);

            default:
                Debug.Fail("Unexpected AccessModifiers value: " + effectiveAccess.ToString());
                return(false);
            }
        }
Example #2
0
        public static string ToString(this AccessModifiers items)
        {
            if ((items & AccessModifiers.Any) == 0)
            {
                return("");
            }
            var value  = new StringBuilder( );
            var values = items.ToString( ).Split(',').ToList( );

            values.TakeWhile(x => x != values.Last( )).ToList( ).ForEach(x => value.Append(string.Format("{0} ", x.ToLower( ))));
            value.Append(string.Format("{0}", values.LastOrDefault( ) == null ? "" : values.Last( ).ToLower( )));

            return(value.ToString( ).Trim( ));
        }
 public static string ToCode(this AccessModifiers access)
 => access == AccessModifiers.None ? String.Empty : access.ToString().ToLowerInvariant();
Example #4
0
        internal static int GetAccessModifierOffset(AccessModifiers access)
        {
            switch (access)
            {
            case AccessModifiers.Public:
                return(0);

            case AccessModifiers.ProtectedInternal:
                return(1);

            case AccessModifiers.Protected:
                return(2);

            case AccessModifiers.Internal:
                return(3);

            case AccessModifiers.Private:
                return(4);

            default:
                throw new ApplicationException("Unexpected AccessModifiers value: " + access.ToString());
            }
        }