示例#1
0
        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);
            }
        }
示例#2
0
        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);
        }