1 public ArrayList loadfile(string filePath) 2 { 3 StreamReader sr = null; 4 try 5 { 6 sr = File.OpenText(filePath); 7 } 8 catch { } 9 10 string line; 11 ArrayList content = new ArrayList(); 12 while ((line = sr.ReadLine()) != null) 13 { 14 content.Add(line); 15 } 16 17 sr.Close(); 18 sr.Dispose(); 19 return content; 20 } 21 22 public void writeData(string content, string filePath) 23 { 24 StreamWriter streamWriter; 25 FileInfo fi = new FileInfo(filePath); 26 if (!fi.Exists) 27 streamWriter = fi.CreateText(); 28 else 29 streamWriter = fi.AppendText(); 30 31 streamWriter.WriteLine(content); 32 streamWriter.Close(); 33 streamWriter.Dispose(); 34 }