I am preparing for MCTS Exam 70-536: Microsoft .NET Framework 2.0 - Application Development Foundation and came across the File IO System. So taking this opportunity here to post few details on the I/O streams to help understand the workings, specially for someone who is just getting started.
The following diagram below describes the I/O Class hierarchy in .Net Framework 2.0.
Represents the base class for many Stream based classes. Streams generally mean a sequence of bytes either flowing in to the system or flowing outside the system.
Specialised Streams These are streams specialized for a specific set of stream operations. Basically these streams inherit from the System.IO.Stream. The examples of such streams include :
These classes help in reading/writing to specialized streams. As shown in the above class diagram we have specialized readers and writers. For text related read/write operations we can use StreamReader or StreamWriter and StringReader and StringWriter classes. All of these classes inherits from TextReader and TextWriter abstract base class.
The StreamWriters or StreamReaders helps in writing or reading text streams to or from the underlying stream. Whereas the StringWriter or StringReader helps in writing or reading from inline memory strings.
Another special kind of readers and writers are the BinaryReader and BinaryWriter classes.These classes help in reading/writing binary data.
Though you can get more specific details on reading and writing to a file however I would like to put few lines to indicate my above theory on basic steps in Reading/Writing a file. So here we go
2: Dim theFile As FileStream
3: theFile = File.Create(fileName)
4: Dim sw As New StreamWriter(theFile)
5: sw.WriteLine("this is a file")
7: Catch ex As Exception
9: End Try
PingBack from http://blog.a-foton.ru/2008/07/file-io-system-in-net/
The diagram misses UnmanagedMemoryStream (though it's arguably a very specialized and rarely-used one, but still...).
This week I am coming to you from the Microsoft Campus. So as you would expect I have a lot of energy
Yes indeed, as you said we dont use UnmanagedMemoryStream unless their is need for you manage the memory yourself.
I'm also studying for the 70-536 exam.
Got any more good resources, guides, free prep tests ? thanks in advance..