DEV Community

Cover image for Write to Text File C#
Bradley Wells
Bradley Wells

Posted on Originally published at wellsb.com on

Write to Text File C#

To write to a text file in C#, you will use a StreamWriter object. In this tutorial, you will learn how to use StreamWriter to write a string to a file synchronously. You can also use StreamWriter to append text to an existing file and to write to a file asynchronously. To use the StreamWriter object, you must include the System.IO directive in your project. To create an instance of a StreamWriter...

Source

Top comments (1)

Collapse
 
codemouse92 profile image
Jason C. McDonald •

(Applies to entire series.)

We encourage the entire article to be published on DEV.to (if you have proper rights), with a linkback if appropriate. Otherwise, we recommend original material, such as an original commentary on the article. From the Terms of Use:

Users must make a good-faith effort to share content that is...not designed primarily for the purposes of promotion or creating backlinks. Additionally, posts must contain substantial content — they may not merely reference an external link that contains the full post.

Posts that are simply intended to encourage readers to view an external resource are discouraged.

Thank you.