Skip to content

Instantly share code, notes, and snippets.

@scriptpapi
Created December 27, 2018 09:52
Show Gist options
  • Save scriptpapi/3df25566dc136d6e6380d8d726ff870c to your computer and use it in GitHub Desktop.
Save scriptpapi/3df25566dc136d6e6380d8d726ff870c to your computer and use it in GitHub Desktop.
C# write to text file
using System;
using System.IO;
namespace Write2Text
{
class Program
{
static void Main(string[] args)
{
using (StreamWriter writetext = new StreamWriter("C:/Users/abdul_na/Desktop/hello.txt"))
{
for (int i = 1; i < 36; i++)
{
writetext.WriteLine("thing number " + i + Environment.NewLine);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment