1 public static string GetFileContents(string FileName)
2 {
3 StreamReader sr = null;
4 string FileContents = null;
5
6 try
7 {
8 FileStream fs = new FileStream(FileName, FileMode.Open,
9 FileAccess.Read);
10 sr = new StreamReader(fs);
11 FileContents = sr.ReadToEnd();
12 }
13 finally
14 {
15 if (sr != null)
16 sr.Close();
17 }
18
19 return FileContents;
20 }