Exemple #1
0
        static Tuple <AccessLevel, SealedEnum, AbstractENum> EmitModifiers(Type type)
        {
            //set defaults
            AccessLevel  _access   = AccessLevel.IsPrivate;
            AbstractENum _abstract = AbstractENum.NotAbstract;
            SealedEnum   _sealed   = SealedEnum.NotSealed;

            // check if not default
            if (type.IsPublic)
            {
                _access = AccessLevel.IsPublic;
            }
            else if (type.IsNestedPublic)
            {
                _access = AccessLevel.IsPublic;
            }
            else if (type.IsNestedFamily)
            {
                _access = AccessLevel.IsProtected;
            }
            else if (type.IsNestedFamANDAssem)
            {
                _access = AccessLevel.IsProtectedInternal;
            }
            if (type.IsSealed)
            {
                _sealed = SealedEnum.Sealed;
            }
            if (type.IsAbstract)
            {
                _abstract = AbstractENum.Abstract;
            }
            return(new Tuple <AccessLevel, SealedEnum, AbstractENum>(_access, _sealed, _abstract));
        }
Exemple #2
0
        private static Tuple <AccessLevel, AbstractENum, StaticEnum, VirtualEnum> EmitModifiers(MethodBase method)
        {
            AccessLevel _access = AccessLevel.IsPrivate;

            if (method.IsPublic)
            {
                _access = AccessLevel.IsPublic;
            }
            else if (method.IsFamily)
            {
                _access = AccessLevel.IsProtected;
            }
            else if (method.IsFamilyAndAssembly)
            {
                _access = AccessLevel.IsProtectedInternal;
            }
            AbstractENum _abstract = AbstractENum.NotAbstract;

            if (method.IsAbstract)
            {
                _abstract = AbstractENum.Abstract;
            }
            StaticEnum _static = StaticEnum.NotStatic;

            if (method.IsStatic)
            {
                _static = StaticEnum.Static;
            }
            VirtualEnum _virtual = VirtualEnum.NotVirtual;

            if (method.IsVirtual)
            {
                _virtual = VirtualEnum.Virtual;
            }
            return(new Tuple <AccessLevel, AbstractENum, StaticEnum, VirtualEnum>(_access, _abstract, _static, _virtual));
        }