public static void SerializeBS(BusinessSystem bs, string fullPath) { BinaryFormatter formatter = new BinaryFormatter(); using (FileStream fs = new FileStream(fullPath, FileMode.OpenOrCreate)) { formatter.Serialize(fs, bs); } }
public static BusinessSystem DeserializeBS(string fullPath) { BinaryFormatter formatter = new BinaryFormatter(); BusinessSystem deserializedBS = new BusinessSystem(); using (FileStream fs = new FileStream(fullPath, FileMode.OpenOrCreate)) { deserializedBS = (BusinessSystem)formatter.Deserialize(fs); } return(deserializedBS); }