C Sharp Basics:
- Part 1: Console Input and Output
- Part 2: File Input and Output
- Part 3: Lists, Dictionaries, and Strings
- Part 4: Working with External Libraries
C# is a multi-paradigm programming language created by Microsoft as part of the .Net initiative in 2000. It has gone on to have its own standard and become part of everything from desktop applications to used extensively in game development.
File Input and Output
Most file interactions in C# work through streams, a connection to a source of data. To work with files is to work through different types of streams. These are part of the File object in System.IO.
Streams can be read using the StreamReader type. (This is a more generalized stream reader type. To specifically deal with Text or Binary data, there is specialized TextReader and BinaryReader functionality.)
To write data to a stream, the object StreamWriter can be used. (Like with StreamReader, there are also specialized objects for Text and Binary operations.)