Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| // <Snippet3> | |
| using System; | |
| using System.IO; | |
| public class Example | |
| { | |
| public static void Main() | |
| { | |
| Char[] buffer = new Char[50]; | |
| { | |
| StreamReader s = new StreamReader("File1.txt"); | |
| try { | |
| int charsRead = 0; | |
| while (s.Peek() != -1) { | |
| charsRead = s.Read(buffer, 0, buffer.Length); | |
| // | |
| // Process characters read. | |
| // | |
| } | |
| s.Close(); | |
| } | |
| finally { | |
| if (s != null) | |
| ((IDisposable)s).Dispose(); | |
| } | |
| } | |
| } | |
| } | |
| // </Snippet3> |