//my own messagebox and own Read File method:
a.MB.ShowDialog(a.Files.ReadText("D:\\test.txt"));
//the Read File method in class a, class Files (my own classes):
/// <summary>
/// Reads a text file from disk.
/// </summary>
public static string ReadText(string path)
{
string s="";
Stream F=new FileStream(path, FileMode.Open, FileAccess.Read);
if(F.Length> long.MaxValue)
{
int onebyte= 0;
int bytesR= 0;
byte[]c= new Byte[ulong.MaxValue];
while(true)
{
onebyte= F.ReadByte();
if(onebyte==-1) {F.Close(); s= Encoding.ASCII.GetString(c, 0, c.Length); return s;}
c[bytesR]= (byte)onebyte; ++bytesR;
}
}
if(F.Length> int.MaxValue)
{
int onebyte= 0;
int bytesR= 0;
byte[]c= new Byte[F.Length];
while(true)
{
onebyte= F.ReadByte();
if(onebyte==-1) {F.Close(); s= Encoding.ASCII.GetString(c, 0, c.Length); return s;}
c[bytesR]= (byte)onebyte; ++bytesR;
}
}
byte[]b=new Byte[F.Length];
F.Read(b, 0, Convert.ToInt32(F.Length));
s= Encoding.ASCII.GetString(b);
F.Close();
return s;
}