C# FileInfo Create

Description

FileInfo Create Creates a file.

Syntax

FileInfo.Create has the following syntax.


public FileStream Create()

Returns

FileInfo.Create method returns A new file.

Example

Creates a file.


using System;//from  w w w. j  a va  2s  . c om
using System.IO;

public class DeleteTest 
{
    public static void Main() 
    {
        FileInfo fi = new FileInfo("temp.txt");
        // Actually create the file.
        FileStream fs = fi.Create();
        fs.Close();
        fi.Delete();
    }
}




















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter