Reading and Writing Data – C# – part 0

It was a lot of times that i didn’t remember how can i write/read to/from file when i needed it … And then i was looking for some information about in google 😉 Now i will have own note about read and write and a lot of others operation on streams and my life will be easier 🙂

Princippal I/O classes of the .NET Framework

  • Stream – Abstract class that supports reading and writing bytes
  • BinaryReader / BinaryWriter – Read and write encoded strings and primitive datatypes to and from streams
  • File, FileInfo, Directory, DirectoryInfo – Provide implementations for the abstract FileSystemInfo classes, including creating, moving, renaming, and deleting files and directories
  • FileStream – For reading to and from File objects; supports random access to files; opens files synchronously by default; supports asynchronous file access
  • TextReader, TextWriter, StringReader, StringWriter – TextReader and TextWriter are abstract classes designed for Unicode character I/O; StringReader and StringWriter write to and from strings, allowing your input and output to be either a stream or a string
  • BufferedStream – A stream that adds buffering to another stream such as a NetworkStream; BufferedStreams can improve the performance of the stream to which they are attached, but note that File Stream has buffering built in
  • MemoryStream – A nonbuffered stream whose encapsulated data is directly accessible in memory, and is most useful asa temporary buffer
  • NetworkStream – A stream over a network connection
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s