What is the purpose of the PropertySpecified pattern used by XML Serialization?
What is the purpose of the PropertySpecified pattern used by XML Serialization ?
What problem doe开发者_开发技巧s it tryto solve ?It tries to solve the problem that int
float
and so on cannot be null, so it has no other way to signal whether the attribute/element exists in the XML file or not.
It was really only useful in .NET 1.x, since in .NET 2 you can just use Nullable<T>
(e.g. int?
) instead.
精彩评论