public void CanSerializeToFile() { var detail = new SampleIni { name = "Abc Sample Company", email = "*****@*****.**", }; var ms = new FileStream(@"C:\TestIni.txt", FileMode.Create); var serializer = new SimpleIniFormatter(); serializer.Serialize(ms, detail); }
static void serialTests() { var file = @"C:\coding\ECNF\RoutePlaner\RoutePlannerTest\data\citiesTestDataLab2.txt"; var cities = new Cities(); cities.ReadCities(file); var bkpFile = @"c:\tmp\serialize.txt"; var stream = new FileStream(bkpFile, FileMode.Create, FileAccess.Write, FileShare.None); var formatter = new SimpleIniFormatter(); formatter.Serialize(stream, cities); }
public void CanSerializeObject() { var detail = new SampleIni { name = "Abc Sample Company", email = "*****@*****.**", }; var ms = new MemoryStream(); var serializer = new SimpleIniFormatter(); serializer.Serialize(ms, detail); var text = Encoding.ASCII.GetString(ms.ToArray()); }