Ejemplo n.º 1
0
 public void SaveTIfExist()
 {
     Path.GetDirectoryName(AbsPath).CheckOrCreateDir();
     AbsPath.CheckOrCreateFile();
     using (FileStream stream = new FileStream(AbsPath, FileMode.OpenOrCreate))
     {
         BinaryFormatter bf = new BinaryFormatter();
         bf.Serialize(stream, instance);
     }
 }
Ejemplo n.º 2
0
        public void SaveTIfExist()
        {
            Path.GetDirectoryName(AbsPath).CheckOrCreateDir();
            AbsPath.CheckOrCreateFile();
            XmlSerializer xs = new XmlSerializer(typeof(T));

            using (FileStream stream = new FileStream(AbsPath, FileMode.OpenOrCreate))
            {
                xs.Serialize(stream, instance);
            }
        }