public static void SerializeObjectRandomForest(string fileName, ListRandomForests objToSerialize) { FileStream fstream = File.Open(fileName, FileMode.Create); BinaryFormatter binaryFormatter = new BinaryFormatter(); binaryFormatter.Serialize(fstream, objToSerialize); fstream.Close(); }
public static ListRandomForests DeserializeObjectRandomForests(string fileName) { ListRandomForests objToSerialize = null; FileStream fstream = File.Open(fileName, FileMode.Open); BinaryFormatter binaryFormatter = new BinaryFormatter(); objToSerialize = (ListRandomForests)binaryFormatter.Deserialize(fstream); fstream.Close(); return(objToSerialize); }