Skip to content

Instantly share code, notes, and snippets.

@mamprogr
Created October 1, 2012 19:08
Show Gist options
  • Save mamprogr/3813762 to your computer and use it in GitHub Desktop.
Save mamprogr/3813762 to your computer and use it in GitHub Desktop.
Read & Write in file.
// Example #1
// Read the file as one string.
string text = System.IO.File.ReadAllText(@"C:\text.txt");
textBox1.Text = text;
/** *************************************** **/
// Example #2
// Write to the file from string.
string txt = "محمد";
System.IO.File.WriteAllText(@"C:\text.txt", txt);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment