コード例 #1
0
 bool ProcessAttributeAttribute(PropertyInfo propertyInfo, XmlAttributeAttribute attribute)
 {
     if (attribute != null)
     {
         var name = string.IsNullOrEmpty(attribute.Name) ? propertyInfo.Name : attribute.Name;
         var id   = PropertyName.CreateForAttribute(name, attribute.Prefix, null);
         properties[id] = new ValuePropertyVisitor(attribute.OmitIfNull, propertyInfo);
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #2
0
 void ProcessNestedAttributes(string nestedName, PropertyVisitor parentProperty)
 {
     foreach (var propertyInfo in GetProperties(parentProperty.PropertyInfo.PropertyType, 0))
     {
         var attributes = propertyInfo.GetCustomAttributes(typeof(XmlAttributeAttribute), false);
         if (attributes.Length != 0)
         {
             var attribute_attribute = (XmlAttributeAttribute)attributes[0];
             var name = string.IsNullOrEmpty(attribute_attribute.Name)
                 ? propertyInfo.Name
                 : attribute_attribute.Name;
             var id = PropertyName.CreateForAttribute(name, attribute_attribute.Prefix, nestedName);
             properties[id] = new NestedValuePropertyVisitor(
                 parentProperty, attribute_attribute.OmitIfNull, propertyInfo);
         }
     }
 }