コード例 #1
0
        private void Salvar(bool Adicionar)
        {
            try
            {
                string json = new JavaScriptSerializer().Serialize(Lista);

                JSonRepository jr = new JSonRepository();
                jr.Salvar(arquivo, json, Adicionar);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public List <Noticia> Listardados()
        {
            try
            {
                JSonRepository jr    = new JSonRepository();
                string         texto = jr.Carregar(arquivo);

                List <Noticia> objNoticia = new List <Noticia>();
                objNoticia = new JavaScriptSerializer().Deserialize <List <Noticia> >(texto);

                return(objNoticia);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }