public void Serialize(TankBattalion <T> tank, string filePath) { var wrap = new TankPack <T>(tank); using (Stream fStream = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.None)) { xml.Serialize(fStream, wrap); } }
public void Serialize(TankBattalion <T> tank, string filePath) { TankPack <T> wrap = new TankPack <T>(tank); var jset = new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }; var json = JsonConvert.SerializeObject(wrap, jset); File.WriteAllText(filePath, json); }