示例#1
0
        public PropertyInfoItem(IPropertyInfo property, bool allowNullEquivalentValue)
        {
            this.property = (IPropertyInfoIntern)property;
            this.AllowNullEquivalentValue = allowNullEquivalentValue;
            Type propertyType = property.PropertyType;

            DeclaringType = property.DeclaringType;
            ElementType   = TypeInfoItemUtil.GetElementTypeUsingReflection(propertyType, null);

            if (propertyType.IsValueType || propertyType.IsPrimitive)
            {
                NullEquivalentValue = NullEquivalentValueUtil.GetNullEquivalentValue(propertyType);
            }
            XmlElementAttribute annotation = property.GetAnnotation <XmlElementAttribute>();

            if (annotation != null)
            {
                XMLName = annotation.ElementName;
            }
            if (XMLName == null || XMLName.Length == 0)
            {
                XMLName = Name;
            }
            xmlIgnore = false;
#if !SILVERLIGHT
            if (property.GetAnnotation <NonSerializedAttribute>() != null)
            {
                xmlIgnore = true;
            }
#endif
            if (property.GetAnnotation <IgnoreDataMemberAttribute>() != null)
            {
                xmlIgnore = true;
            }
            if (property.GetAnnotation <XmlIgnoreAttribute>() != null)
            {
                xmlIgnore = true;
            }
            if (!CanRead || !CanWrite)
            {
                xmlIgnore = true;
            }
        }
示例#2
0
 public override V GetAnnotation <V>()
 {
     return(property.GetAnnotation <V>());
 }