Beispiel #1
0
        static void Main(string[] args)
        {
            string urlFileName = System.IO.Path.Combine(@"E:\Estudos", string.Format("Log_{0}.xml", DateTime.Now.Date.Ticks));

            IList<Log> logs = new List<Log>();
            logs.Add( new Log(){ Usuario = "Juliano", Email = "*****@*****.**", Idade = 27, DataHora = DateTime.Now});
            logs.Add( new Log(){ Usuario = "Thiago", Email = "*****@*****.**", Idade = 35, DataHora = DateTime.Now});
            logs.Add( new Log(){ Usuario = "João", Email = "*****@*****.**", Idade = 20, DataHora = DateTime.Now});

            Repositorio repositorio = new Repositorio();
            repositorio.SalvarLogXML(logs, urlFileName);

            logs.Clear();
            logs.Add(new Log() { Usuario = "Ricardo", Email = "*****@*****.**", Idade = 40, DataHora = DateTime.Now });
            logs.Add(new Log() { Usuario = "Marcelo", Email = "*****@*****.**", Idade = 23, DataHora = DateTime.Now });

            repositorio.SalvarLogXML(logs, urlFileName);

            var oldLogs = repositorio.RetornarLogs(urlFileName);
        }