EDN Admin
Well-known member
I am building a class and i am starting the process of serializing it to XML format. For most of the Properties/Attributes they are a single data-type. But i have a couple that have the possibility of having multiple kinds of data-types.
For example:
<div style="color:Black;background-color:White; <pre>
[XmlAttribute(AttributeName=<span style="color:#A31515; "BaseType", DataType=<span style="color:#A31515; "string")]
[XmlAttribute(AttributeName=<span style="color:#A31515; "BaseType", DataType=<span style="color:#A31515; "integer")]
<span style="color:Blue; public <span style="color:Blue; string BaseType {
...
}
[/code]
I am positive this is a well-formed design but want to verify. In the logic of this property, i have it validating whether value is string or int (via parse) but not sure if using the XMLAttributeAttribute this way is best way or if i should just have
two properties each accepting string or int and attaching the appropriate Attribute to the property.
Thank you in advance! <hr class="sig "I am the reason, Curiosity killed the Cat!" Please be patient, there are times where i do not respond for weeks at a time.
http://www.developerfusion.com/tools/ Developer Fusion Tool
View the full article
For example:
<div style="color:Black;background-color:White; <pre>
[XmlAttribute(AttributeName=<span style="color:#A31515; "BaseType", DataType=<span style="color:#A31515; "string")]
[XmlAttribute(AttributeName=<span style="color:#A31515; "BaseType", DataType=<span style="color:#A31515; "integer")]
<span style="color:Blue; public <span style="color:Blue; string BaseType {
...
}
[/code]
I am positive this is a well-formed design but want to verify. In the logic of this property, i have it validating whether value is string or int (via parse) but not sure if using the XMLAttributeAttribute this way is best way or if i should just have
two properties each accepting string or int and attaching the appropriate Attribute to the property.
Thank you in advance! <hr class="sig "I am the reason, Curiosity killed the Cat!" Please be patient, there are times where i do not respond for weeks at a time.
http://www.developerfusion.com/tools/ Developer Fusion Tool
View the full article