Пример #1
0
        public void Put <T>(List <T> items) where T : TextPaper
        {
            List <string> lines = new List <string>();

            foreach (T item in items)
            {
                lines.Add(TxtConverter.ToWritebleTxt(item));
            }

            File.WriteAllLines(_fileName, lines);
        }
Пример #2
0
        public List <T> Get <T>() where T : TextPaper
        {
            List <T> items = new List <T>();

            if (!System.IO.File.Exists(_fileName))
            {
                System.IO.File.CreateText(_fileName);
            }
            string[] lines = System.IO.File.ReadAllLines(_fileName);

            foreach (string line in lines)
            {
                T textPaper;
                TxtConverter.ReadFromString <T>(line, out textPaper);
                items.Add(textPaper);
            }

            return(items);
        }