C# FileInfo CreationTime

Description

FileInfo CreationTime Gets or sets the creation time of the current file or directory.

Syntax

FileInfo.CreationTime has the following syntax.


public DateTime CreationTime { get; set; }

Example


/*from w  w  w  . ja v a  2 s  .  c o m*/
using System;
using System.IO;
using System.Security.AccessControl;

class FileExample
{
    public static void Main()
    {
        string FileName = @"c:\MyTest.txt";
        FileInfo fInfo = new FileInfo(FileName);
        Console.WriteLine(fInfo.CreationTime);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.IO »




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