public static void SaveConfiguration <P>(IConfiguration configuration, string filePath) { var serializer = new GenericSerializer <P>(); using (TextWriter textWriter = File.CreateText(filePath)) { serializer.Serialize(textWriter, configuration); } }
public static P LoadConfiguration <P>(string filePath) { var serializer = new GenericSerializer <P>(); using (TextReader textReader = File.OpenText(filePath)) { P loadedConfig = (P)serializer.Deserialize(textReader); return(loadedConfig); } }