The File and StreamWriter Classes
The StreamWriter class implements a TextWriter for writing characters to a stream in a particular encoding. StreamWriter is designed for character output in a particular encoding, whereas subclasses of Stream are designed for byte input and output.
StreamWriter defaults to UTF8Encoding unless specified otherwise. UTF-8 handles Unicode characters correctly and gives consistent results on localized versions of the operating system.
This section creates a sample application that enables users to write a message, and then saves the message to a disk file so that other users can read the message. The code that reads and displays the message file appears in the preceding section.
Creating a Text File
Before any data ...
Get Special Edition Using® Microsoft® ASP.NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.