public static void LoadVariable(string file, ref EnvironmentVariable variable) { try { FileStream stream = File.OpenRead(file); XmlSerializer xmlSerializer = new XmlSerializer(variable.GetType()); variable = (EnvironmentVariable)xmlSerializer.Deserialize(stream); stream.Close(); } catch (Exception ex) { throw ex; } }
public static void SaveVariable(string file, ref EnvironmentVariable variable) { try { FileStream stream = File.Create(file); XmlSerializer xmlSerializer = new XmlSerializer(variable.GetType()); xmlSerializer.Serialize(stream, variable); stream.Close(); } catch (Exception ex) { throw ex; } }