StreamReader.ReadToEnd()
using System;
using System.IO;
public class StreamReaderAndWriter {
static void Main(string[] args)
{
StreamReader MyStreamReader = new StreamReader(@"c:\Testing.txt");
FileStream MyFileStream = new FileStream(@"c:\Testing.txt", FileMode.Open, FileAccess.Read, FileShare.None);
StreamReader MyStreamReader2 = new StreamReader(MyFileStream);
MyFileStream.Close();
MyStreamReader2.Close();
string MyStringReader = MyStreamReader.ReadLine();
string MyStringReadToEOF = MyStreamReader.ReadToEnd();
int[] MyArrayOfCharacters = new int[100];
for (int i = 0; i < 99; i++)
{
MyArrayOfCharacters[i] = MyStreamReader.Read();
}
MyStreamReader.Close();
}
}
Related examples in the same category