コード例 #1
0
        public AssemblyConstructor(ConstructorInfo constructor)
        {
            if (constructor.IsPublic)
            {
                Modifier = AccessModifier.Public;
            }

            if (constructor.IsPrivate)
            {
                Modifier = AccessModifier.Private;
            }

            if (constructor.IsFamily)
            {
                Modifier = AccessModifier.Protected;
            }

            if (constructor.IsAssembly)
            {
                Modifier = AccessModifier.Internal;
            }

            ParameterInfo[] parameters = constructor.GetParameters();
            Parameters = new List <AssemblyParameter>();
            foreach (var parameter in parameters)
            {
                var newParameter = new AssemblyParameter(parameter);
                Parameters.Add(newParameter);
            }

            IsStatic = constructor.IsStatic;
        }
コード例 #2
0
        public AssemblyMethod(MethodInfo methodInfo)
        {
            Name      = methodInfo.Name;
            ValueType = methodInfo.ReturnType;

            if (methodInfo.IsPublic)
            {
                Modifier = AccessModifier.Public;
            }

            if (methodInfo.IsPrivate)
            {
                Modifier = AccessModifier.Private;
            }

            if (methodInfo.IsFamily)
            {
                Modifier = AccessModifier.Protected;
            }

            if (methodInfo.IsAssembly)
            {
                Modifier = AccessModifier.Internal;
            }

            MethodAttributes attr = methodInfo.Attributes;

            IsVirtual  = (attr & MethodAttributes.Virtual) != 0;
            IsAbstract = (attr & MethodAttributes.Abstract) != 0;
            IsStatic   = (attr & MethodAttributes.Static) != 0;


            Parameters = new List <AssemblyParameter>();
            ParameterInfo[] parameters = methodInfo.GetParameters();
            foreach (var parameter in parameters)
            {
                var newParameter = new AssemblyParameter(parameter);
                Parameters.Add(newParameter);
            }
        }