I haven't found any exact documentation on this and there's not really much to the question; are we required to use DataType = "string"
instead of typeof(string)
when working with the XmlAttributeAttribute
? For example:
XmlAttribute("Description", DataType = "string")
XmlAttribute("Description", typeof(string))
Both of the lines above compile; however, when using the typeof(string)
method, I get an error saying primitive types can't be specified (could this be related to the nesting of classes and overridden properties?).
If you remove the DataType
all together, for some reason reflection fails and the build won't succeed.
Am I doing something wrong, or is this the way it is meant to be? If the requirement is to use the DataType
method, then how do you specify custom types such as enum
?
Aucun commentaire:
Enregistrer un commentaire