XmlPropertyAttribute
Namespace: SnowBank.Data.Xml · class
Implements: Attribute
Attribute that controls how a field or property is projected into XML output
Remarks
This is where every XML-only concern lives: the existing JSON attributes ([JsonProperty], [JsonPropertyName], [JsonIgnore], ...) are never modified by this feature. The resolution ladder, per setting (never all-or-nothing), is: (1) the defaults of the container's CrystalXmlSerializerDefaults profile; (2) the JSON attributes, which supply the output name as-is (never re-transformed by a naming policy); (3) this attribute, which overrides option by option (a lone ItemName still lets Name fall back to step 2, then to the naming-policy-transformed .NET member name).
Constructors
XmlPropertyAttribute
XmlPropertyAttribute()
Configure how this field or property is projected into XML
XmlPropertyAttribute(string name)
Configure how this field or property is projected into XML
Properties
Attribute
bool Attribute { get; set; }
Projects this member as an XML ATTRIBUTE (annotation) instead of a nested element
Scalars only; forbidden on a complex type or a collection. Also forbidden under the profile, which has no concept of a user-facing XML attribute.
DictionaryFormat
CrystalXmlDictionaryFormat DictionaryFormat { get; set; }
Dictionary representation for this member
inherits from the profile, or from the container's .
ItemName
string ItemName { get; set; }
Name used for collection items and dictionary entries
Setting this on a collection member switches it to the wrapped form (ex:
Name
string Name { get; set; }
XML name for this member
Sugar: a leading "@" (ex: "@id") is normalized at compile time into without the prefix, with set to . This runtime attribute only ever stores the already-normalized value; the generator performs the substitution.