March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System; using System.IO; using System.Text; namespace Samples { public class StreamReaderSample { public static void Main() { string s = "streamreader.txt"; using(StreamReader sr = new StreamReader(s)) { DisplayInformationAboutStream(sr); Console.WriteLine(sr.ReadLine()); Console.WriteLine((Char)sr.Peek()); Console.WriteLine(sr.ReadLine()); } Byte[] bytes = {72, 101, 108, 108, 111, (byte) '\n', 87, 111, 114, 108, 100}; MemoryStream ms = new MemoryStream(bytes, 0, bytes.Length); using(StreamReader sr = new StreamReader(ms)) { DisplayInformationAboutStream(sr); Console.WriteLine(sr.ReadLine()); Console.WriteLine((Char)sr.Peek()); Console.WriteLine(sr.ReadLine()); } } public static void DisplayInformationAboutStream( StreamReader ...Read now
Unlock full access