I’ve got a class with a System.Version property, which looks like this:
- Version
- Build: 111
- Major: 1
- MajorRevision: 0
- Minor: 1
- MinorRevision: 10
- Revision: 10
When I serialize the class, version is always empty:
<Version />
The Client class looks like:
[Serializable]
public class Client
{
public string Description;
public string Directory;
public DateTime ReleaseDate;
public Version Version;
}
System.Versionis not serializable, if you look at it’s properties on MSDN, you’ll see they have no setters…so the serializer won’t store them. However, this approach still works. That article (old but still works) provides a Version class that is serializable, can you switch to that and get going?Edit by tomfanning
I have fished the code from the dead site out of archive.org, reproduced below.