C# Write to File: WriteAllText, WriteAllLines, AppendAllText, and StreamWriter
How to write to a file in C# with File.WriteAllText, WriteAllLines, WriteAllBytes, AppendAllText, async methods, and StreamWriter, with tested examples.
I'm a .NET developer who shares what I learn. I've been building with .NET for over a decade, and I love writing about ASP.NET Core, C#, and web development. When I'm not coding, I'm probably traveling with my wife Nicole or going on long walks with our two dogs.
How to write to a file in C# with File.WriteAllText, WriteAllLines, WriteAllBytes, AppendAllText, async methods, and StreamWriter, with tested examples.
If you’ve followed this blog and my social media accounts, you know I’ve had a bit of a design itch that needs scratching, and it occasionally needs scratched. Well, consider it scratched, again! I published a batch of new shirts on my Bonfire store, ranging from .NET-flavored jokes to retro computing nostalgia and a few marble statues for good measure.
To be clear, this isn’t a business. I wanted to make some fun things that exist in the real world and not just on a screen. All proceeds go to World Central Kitchen, which provides meals to people in the wake of crises.
If one of the designs makes you smile, grab a shirt. You get something fun to wear, and someone gets a warm meal. 👕
Also, if you ever see me in the wild and you happen to be wearing one of these shirts, please say hi! If we can’t meet in person, feel free to share a photo of you wearing one of the shirts on social media and tag me. I’d love to see it!