Writing to an output text file and finding out extra characters or lines in it?

If you’re using File.OpenWrite() to create the output file, make sure the output file does not exist.  This MSDN article explains what happens if output file exists:

For an existing file, it does not append the new text to the existing text. Instead, it overwrites the existing characters with the new characters. If you overwrite a longer string (such as “This is a test of the OpenWrite method”) with a shorter string (such as “Second run”), the file will contain a mix of the strings (“Second runtest of the OpenWrite method”).


What’s new in C# 6?

Even though I’m still using VS2013 for all the projects I’m working on, it won’t hurt to know the new features of C# 6 in VS2015.  I might start converting some of them or maybe start the new projects in VS2015, who knows.

I won’t try to write about the new features in C# 6 in this post as I am pretty sure you can find them on the Internet.  Though there is one that I like and it’s New Language Features in C# 6.  I hope this helps.


Microsoft Docs has a What’s new in C# 6 article which I think is where the above article is based on.  Also check out their The history of C# article to refresh yourself on the features added to previous versions of C#.  There is now also What’s new in C# 7.0 and What’s new in C# 7.1.