Skip to content
< All Topics

Serialization

Experior saves a model by serializing all necessary model entities (actually their corresponding Info objects) into specific xml files and compressing those into an experior file.

Loading a model works vice versa, the experior file is uncompressed and each xml file it contains is deserialized.

The serializing and deserializing can be done using System.Xml.Serialization.XmlSerializer.

However Experior also provides a utility class Experior.Core.Environment.Serialization to make this process simpler.

Example:

// Log all serializable types
List<Type> serializable = Experior.Core.Environment.SerializableTypes;
Experior.Core.Environment.Log.Write("We found " + ser.Count + " serializable types.");
foreach (var t in serializable)
{
    Experior.Core.Environment.Log.Write(" : " + t.ToString());
}
// create the test.xml file and serialize the Info object of this assembly into it
Experior.Core.Environment.Serialization.Serialize("test.xml", this.Info);

// load the test.xml file and deserialize into a AssemblyInfo object
AssemblyInfo res = (AssemblyInfo)Experior.Core.Environment.Serialization.DeSerialize("test.xml", typeof(AssemblyInfo));
Was this article helpful?
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.