Difference between revisions of "Reading an writing test files in csharp"
From MyWiki
(Created page with "'''Writing to a Text File'''<br> Listing 1: Writing Text Data to a File: TextFileWriter.cs<br> <source lang="csharp"> using System; using System.IO; namespace csharp_station....") |
(No difference)
|
Revision as of 21:48, 27 March 2015
Writing to a Text File
Listing 1: Writing Text Data to a File: TextFileWriter.cs
using System; using System.IO; namespace csharp_station.howto { class TextFileWriter { static void Main(string[] args) { // create a writer and open the file TextWriter tw = new StreamWriter("date.txt"); // write a line of text to the file tw.WriteLine(DateTime.Now); // close the stream tw.Close(); } } }