Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Kucich
- {
- class FileTesto
- {
- private string nomeFile;
- public FileTesto(string nomeFile)
- {
- this.nomeFile = nomeFile;
- }
- public string NomeFile
- {
- set
- {
- nomeFile = value;
- }
- get
- {
- return nomeFile;
- }
- }
- public void Crea()
- {
- if (!File.Exists(nomeFile))
- {
- StreamWriter file = new StreamWriter(nomeFile, false);
- file.Close();
- }
- }
- public void Scrivi(string riga)
- {
- StreamWriter file = new StreamWriter(nomeFile, true); // append
- file.WriteLine(riga);
- file.Close();
- }
- public ArrayList Leggi()
- {
- string riga;
- ArrayList list = new ArrayList();
- StreamReader file = new StreamReader(nomeFile);
- while (!file.EndOfStream)
- {
- riga = file.ReadLine();
- list.Add(riga);
- }
- file.Close();
- return list;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement