Home
Manage Your Code
Snippet: Write string to a file. (C#)
Title: Write string to a file. Language: C#
Description: Writes any string to a file using StreamWriter Views: 286
Author: Robert Taylor Date Added: 5/12/2008
Copy Code  
1string text = "Hello World";
2
3System.IO.TextWriter tw = new System.IO.StreamWriter("c:\\output.txt");
4tw.WriteLine(text);
5tw.Close();