public static void Serialize(ResearcherObservableCollection col, string fileName) { FileStream stream = new FileStream(fileName, FileMode.Create, FileAccess.Write); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, col); col.Updated = false; stream.Close(); }
public static ResearcherObservableCollection Deserialize(string fileName) { FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read); BinaryFormatter formatter = new BinaryFormatter(); ResearcherObservableCollection result = formatter.Deserialize(stream) as ResearcherObservableCollection; result.Updated = false; result.Subscribe(); foreach (var res in result) { res.PropertyChanged += result.OnItemPropertyChanged; } stream.Close(); return(result); }