Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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());
        }