1public static string ReadTextFile(string Path)
2{
3 if (System.IO.File.Exists(Path))
4 {
5 System.IO.StreamReader sr = null;
6 try
7 {
8 sr = new System.IO.StreamReader(Path);
9 return sr.ReadToEnd();
10 }
11 catch
12 {
13 return string.Empty;
14 }
15 finally
16 {
17 if (sr != null)
18 sr.Close();
19 }
20 }
21 else
22 return string.Empty;
23}