Ejemplo n.º 1
0
        private static object GetValueFromAttribute(IType attributeType, ReferenceStep referenceStep, Type type, bool inherits)
        {
            object        obj = null;
            PlatformTypes platformMetadata = (PlatformTypes)attributeType.PlatformMetadata;

            Attribute[] customAttributes = platformMetadata.GetCustomAttributes(type, attributeType.RuntimeType, inherits);
            int         num = 0;

            if (num < (int)customAttributes.Length)
            {
                obj = customAttributes[num];
            }
            if (obj == null)
            {
                return(null);
            }
            return(referenceStep.GetValue(obj));
        }
        public override object[] GetCustomAttributes(Type attributeType, bool inherits)
        {
            PlatformTypes platformMetadata = (PlatformTypes)base.PlatformMetadata;

            return(platformMetadata.GetCustomAttributes(this.propertyInfo, attributeType, inherits));
        }
Ejemplo n.º 3
0
        public static KeyValuePair <bool, object> GetDefaultValue(PlatformTypes platformTypes, MemberInfo memberInfo, Type valueType)
        {
            object result;

            if (PlatformNeutralAttributeHelper.TryGetAttributeValue <object>((IEnumerable)platformTypes.GetCustomAttributes(memberInfo), PlatformTypes.DefaultValueAttribute, "Value", out result) && (!valueType.IsValueType && (result == null || valueType.IsAssignableFrom(result.GetType())) || valueType.IsValueType && result != null && valueType.IsAssignableFrom(result.GetType())))
            {
                return(new KeyValuePair <bool, object>(true, result));
            }
            return(PlatformTypeHelper.GetDefaultValue(valueType));
        }
Ejemplo n.º 4
0
        internal static DesignerSerializationVisibility GetSerializationVisibility(PlatformTypes platformTypes, MemberInfo memberInfo)
        {
            DesignerSerializationVisibility result;

            if (PlatformNeutralAttributeHelper.TryGetAttributeValue <DesignerSerializationVisibility>((IEnumerable)platformTypes.GetCustomAttributes(memberInfo), PlatformTypes.DesignerSerializationVisibilityAttribute, "Visibility", out result))
            {
                return(result);
            }
            return(DesignerSerializationVisibility.Visible);
        }