My program generates some numeric results which are held together in a class:
[Serializable]
public class Examination
{
public string _examiner { get; set; }
public string _interpretation { get; set; }
DateTime _examination_date { get; set; }
// two following properties about 100x100 in size
public Point3D[,] _surface_coordinates { get; set; }
public double [,] _mapa_curvatura { get; set; }
public Point3DCollection _symmetry_line { get; set; }
}
Now I want to persist this using serialization (no need for ORM/Database in principle), and I am having some doubts:
- I need the serialized data to be accessible to scripts in other languages (Python mostly) so I wouldn't use Binary Serialization, using XmlSerialization instead;
- Multidimensional data is not supported, so I had to convert
[,]arrays to[][]arrays, which looked a bit "dirty" to me (not big deal, though, if that were the only matter); - The resulting XML is a bit too big (2Mb per file), while I was getting results a lot smaller with quick'n'dirty binary formats in python (for example, saving array of doubles to a long string, putting rows and columns in the filename itself, then parsing it and reshaping during deserialization: not pretty too!).
Since I am a complete beginner in the Serialization field, I would like to ask: "Which would be an adviseable strategy/tactic to serialize and deserialize this class to disk?" Primary requirements would be:
- Readable in other languages;
- Compact file size;
- Respecting C#/.NET good-practices and common idioms;
Thanks for reading!