Пример #1
0
        public WrappedMethod(MethodInfo methodInfo)
        {
            this.methodName = methodInfo.Name;
            this.returnType = DataTypeHelper.GetWrappedDataTypeFromSystemType(methodInfo.ReturnType);

            parameters = new List <WrappedParameter>();
            foreach (ParameterInfo parameterInfo in methodInfo.GetParameters())
            {
                parameters.Add(new WrappedParameter(parameterInfo));
            }

            if (methodInfo.ReturnType.IsValueType)
            {
                returnTypeAttributes |= VariableAttributes.IsValueType;
            }
            if (methodInfo.IsStatic)
            {
                this.methodAttributes |= MethodAttributes.Static;
            }
            if (AttributeHelper.IsObsolete(methodInfo.GetCustomAttributes(false)))
            {
                this.methodAttributes |= MethodAttributes.Obsolete;
            }

            if (methodInfo.ContainsGenericParameters)
            {
                this.methodAttributes |= MethodAttributes.ContainsGenericParameters;
            }
        }
Пример #2
0
        public WrappedVariable(FieldInfo fieldInfo, object objectValue)
            : this(fieldInfo.Name, objectValue, fieldInfo.FieldType, true)
        {
            this.variableName = fieldInfo.Name;

            if (fieldInfo.IsInitOnly)
            {
                this.attributes |= VariableAttributes.ReadOnly;
            }
            if (fieldInfo.IsStatic)
            {
                this.attributes |= VariableAttributes.IsStatic;
            }
            if (fieldInfo.IsLiteral)
            {
                this.attributes |= VariableAttributes.IsLiteral;
            }
            if (fieldInfo.FieldType.IsValueType)
            {
                this.attributes |= VariableAttributes.IsValueType;
            }
            if (AttributeHelper.IsObsolete(fieldInfo.GetCustomAttributes(false)))
            {
                this.attributes |= VariableAttributes.Obsolete;
            }
        }
Пример #3
0
        public WrappedVariable(PropertyInfo propertyInfo, object objectValue)
            : this(propertyInfo.Name, objectValue, propertyInfo.PropertyType, true)
        {
            MethodInfo getMethod = propertyInfo.GetGetMethod(true);
            MethodInfo setMethod = propertyInfo.GetSetMethod(true);

            if (setMethod == null)
            {
                this.attributes |= VariableAttributes.ReadOnly;
            }
            if (getMethod.IsStatic)
            {
                this.attributes |= VariableAttributes.IsStatic;
            }
            if (propertyInfo.PropertyType.IsValueType)
            {
                this.attributes |= VariableAttributes.IsValueType;
            }
            if (AttributeHelper.IsObsolete(propertyInfo.GetCustomAttributes(false)))
            {
                this.attributes |= VariableAttributes.Obsolete;
            }
        }