예제 #1
0
        private void SerializeXml(string log, string pass)
        {
            var dataRemember = new InfoCheckBox {
                Login = log, Password = pass
            };
            var xmlFormatter = new XmlSerializer(typeof(InfoCheckBox));

            using (var file = new FileStream("checkBoxXml.xml", FileMode.OpenOrCreate))
                xmlFormatter.Serialize(file, dataRemember);
        }
예제 #2
0
        private void SerializeJson(string log, string pass)
        {
            var dataRemember = new InfoCheckBox {
                Login = log, Password = pass
            };
            var jsonFormatter = new DataContractJsonSerializer(typeof(InfoCheckBox));

            using (var file = new FileStream("checkBoxJson.json", FileMode.OpenOrCreate))
                jsonFormatter.WriteObject(file, dataRemember);
        }