Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Serializable]
- public class SCMng
- {
- [XmlElement("SC")]
- public ObservableCollection<SC> SCCollection { get; set; }
- [XmlIgnore]
- public SC SCPreview { get; set; }
- public SCMng()
- {
- this.SCCollection = new ObservableCollection<SC>();
- this.SCPreview = new SC();
- }
- public void SaveMD(string pPath)
- {
- Directory.CreateDirectory(Path.GetDirectoryName(pPath));
- if (System.IO.File.Exists(pPath))
- System.IO.File.Delete(pPath);
- var ser = new XmlSerializer(typeof(SCMng));
- using (var fs = new FileStream(pPath, FileMode.OpenOrCreate))
- ser.Serialize(fs, this);
- }
- }
- SCMng fooBar = new SCMng();
- public void Save(){
- this.fooBar.SaveMD(AppDomain.CurrentDomain.BaseDirectory + @"new.xml");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement