Friday, 11 October 2013

How to create a file in C# .Net

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace file
{
    class Program
    {
        static void Main(string[] args)
        {
            string path = "my_text.txt";
           

            if (!File.Exists(path))
            {

                StreamWriter sw = new StreamWriter(path);

                sw.WriteLine("hello");

                sw.Close();
            }
   
        }
    }
}

2 comments: