Create a text file in CSharp

Description

The following code shows how to create a text file.

Example


// w  ww. j a v a2s  .c  om
using System;
using System.IO;

public class MainClass
{
  public static void Main()
  {
    FileInfo MyFile = new FileInfo(@"c:\Test.txt");

    MyFile.Create();
    Console.WriteLine("done");
  }
}




















Home »
  C# Tutorial »
    IO »




File Attribute
File Security
Directory Attribute
Directory Recursive
Binary File
Text Field
Buffered IO
Create Copy Delete Move
CSV
Drive
File System Watcher
Isolated Storage
MemoryStream
Serialize
Zip